Class: Lutaml::Model::Sequence
- Inherits:
-
Object
- Object
- Lutaml::Model::Sequence
- Defined in:
- lib/lutaml/model/sequence.rb
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
-
#model ⇒ Object
Returns the value of attribute model.
Instance Method Summary collapse
- #attribute(name, type, options = {}) ⇒ Object
- #import_model_mappings(model) ⇒ Object
-
#initialize(model) ⇒ Sequence
constructor
A new instance of Sequence.
- #map_all ⇒ Object
- #map_attribute ⇒ Object
- #map_content ⇒ Object
- #map_element(name, **kwargs) ⇒ Object
- #sequence(&block) ⇒ Object
- #validate_content!(element_order, model_class) ⇒ Object
Constructor Details
#initialize(model) ⇒ Sequence
Returns a new instance of Sequence.
7 8 9 10 |
# File 'lib/lutaml/model/sequence.rb', line 7 def initialize(model) @attributes = [] @model = model end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
5 6 7 |
# File 'lib/lutaml/model/sequence.rb', line 5 def attributes @attributes end |
#model ⇒ Object
Returns the value of attribute model.
4 5 6 |
# File 'lib/lutaml/model/sequence.rb', line 4 def model @model end |
Instance Method Details
#attribute(name, type, options = {}) ⇒ Object
12 13 14 15 |
# File 'lib/lutaml/model/sequence.rb', line 12 def attribute(name, type, = {}) [:sequence] = self @model.attribute(name, type, ) end |
#import_model_mappings(model) ⇒ Object
25 26 27 28 29 30 31 |
# File 'lib/lutaml/model/sequence.rb', line 25 def import_model_mappings(model) return import_mappings_later(model) if later_importable?(model) raise Lutaml::Model::ImportModelWithRootError.new(model) if model.root? @model.import_model_mappings(model) @attributes.concat(Utils.deep_dup(model.mappings_for(:xml).elements)) end |
#map_all ⇒ Object
41 42 43 |
# File 'lib/lutaml/model/sequence.rb', line 41 def map_all(*) raise Lutaml::Model::UnknownSequenceMappingError.new("map_all") end |
#map_attribute ⇒ Object
33 34 35 |
# File 'lib/lutaml/model/sequence.rb', line 33 def map_attribute(*) raise Lutaml::Model::UnknownSequenceMappingError.new("map_attribute") end |
#map_content ⇒ Object
37 38 39 |
# File 'lib/lutaml/model/sequence.rb', line 37 def map_content(*) raise Lutaml::Model::UnknownSequenceMappingError.new("map_content") end |
#map_element(name, **kwargs) ⇒ Object
21 22 23 |
# File 'lib/lutaml/model/sequence.rb', line 21 def map_element(name, **kwargs) @attributes << @model.map_element(name, **kwargs) end |
#sequence(&block) ⇒ Object
17 18 19 |
# File 'lib/lutaml/model/sequence.rb', line 17 def sequence(&block) instance_eval(&block) end |
#validate_content!(element_order, model_class) ⇒ Object
45 46 47 48 49 50 |
# File 'lib/lutaml/model/sequence.rb', line 45 def validate_content!(element_order, model_class) validate_sequence!( extract_defined_order(model_class.attributes), element_order, ) end |