Class: Glossarist::ConceptSource
- Includes:
- Utilities::CommonFunctions, Utilities::Enum
- Defined in:
- lib/glossarist/concept_source.rb
Instance Attribute Summary collapse
-
#modification ⇒ Object
Returns the value of attribute modification.
-
#origin ⇒ Object
(also: #ref)
Returns the value of attribute origin.
Instance Method Summary collapse
-
#initialize(attributes = {}) ⇒ ConceptSource
constructor
A new instance of ConceptSource.
- #to_h ⇒ Object
Methods included from Utilities::CommonFunctions
Methods included from Utilities::Enum
Methods inherited from Model
Constructor Details
#initialize(attributes = {}) ⇒ ConceptSource
Returns a new instance of ConceptSource.
16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/glossarist/concept_source.rb', line 16 def initialize(attributes = {}) if rel = attributes.delete("relationship") self.status = rel["type"] self.modification = rel["modification"] end self.origin = slice_keys(attributes, ref_param_names) remaining_attributes = attributes.dup ref_param_names.each { |k| remaining_attributes.delete(k) } super(remaining_attributes) end |
Instance Attribute Details
#modification ⇒ Object
Returns the value of attribute modification.
14 15 16 |
# File 'lib/glossarist/concept_source.rb', line 14 def modification @modification end |
#origin ⇒ Object Also known as: ref
Returns the value of attribute origin.
11 12 13 |
# File 'lib/glossarist/concept_source.rb', line 11 def origin @origin end |
Instance Method Details
#to_h ⇒ Object
36 37 38 39 40 41 42 43 44 45 |
# File 'lib/glossarist/concept_source.rb', line 36 def to_h origin_hash = self.origin.to_h.empty? ? nil : self.origin.to_h { "type" => type.to_s, "status" => status&.to_s, "origin" => origin_hash, "modification" => modification, }.compact end |