-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
updated to use glossarist models for concept and managed_concept
- Loading branch information
1 parent
25dc7fe
commit c71a3be
Showing
7 changed files
with
84 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
module Tc211::Termbase | ||
module Glossarist | ||
class Concept < ::Glossarist::LocalizedConcept | ||
attr_accessor :status, :dateAccepted | ||
|
||
def uuid | ||
@uuid ||= ::Glossarist::Utilities::UUID.uuid_v5( | ||
::Glossarist::Utilities::UUID::OID_NAMESPACE, | ||
to_h(only_data: true).to_yaml, | ||
) | ||
end | ||
|
||
def to_h(only_data: false) | ||
date_accepted = dates.find(&:accepted?) | ||
|
||
data_hash = super() | ||
return data_hash if only_data | ||
|
||
data_hash.merge({ | ||
"dateAccepted" => date_accepted&.date&.dup, | ||
"id" => uuid, | ||
"status" => entry_status, | ||
}.compact) | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
module Tc211::Termbase | ||
module Glossarist | ||
class ManagedConcept < ::Glossarist::ManagedConcept | ||
attr_accessor :status | ||
|
||
def uuid | ||
@uuid ||= ::Glossarist::Utilities::UUID.uuid_v5( | ||
::Glossarist::Utilities::UUID::OID_NAMESPACE, | ||
to_h(only_data: true).to_yaml, | ||
) | ||
end | ||
|
||
def to_h(only_data: false) | ||
data_hash = super() | ||
return data_hash if only_data | ||
|
||
date_accepted = default_lang.dates.find(&:accepted?) | ||
data_hash.merge({ | ||
"dateAccepted" => date_accepted&.date&.dup, | ||
"id" => uuid, | ||
"related" => related&.map(&:to_h) || [], | ||
"status" => default_lang.entry_status, | ||
}.compact) | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters