Class: Lutaml::Model::Schema::XmlCompiler::Sequence
- Inherits:
-
Object
- Object
- Lutaml::Model::Schema::XmlCompiler::Sequence
- Defined in:
- lib/lutaml/model/schema/xml_compiler/sequence.rb
Constant Summary collapse
- XML_MAPPING_TEMPLATE =
ERB.new("<%= indent %>sequence do\n<%= content -%>\n<%= indent %>end\n", trim_mode: "-")
Instance Attribute Summary collapse
-
#instances ⇒ Object
Returns the value of attribute instances.
Instance Method Summary collapse
- #<<(instance) ⇒ Object
-
#initialize ⇒ Sequence
constructor
A new instance of Sequence.
- #required_files ⇒ Object
- #to_attributes(indent) ⇒ Object
- #to_xml_mapping(indent) ⇒ Object
Constructor Details
#initialize ⇒ Sequence
Returns a new instance of Sequence.
16 17 18 |
# File 'lib/lutaml/model/schema/xml_compiler/sequence.rb', line 16 def initialize @instances = [] end |
Instance Attribute Details
#instances ⇒ Object
Returns the value of attribute instances.
8 9 10 |
# File 'lib/lutaml/model/schema/xml_compiler/sequence.rb', line 8 def instances @instances end |
Instance Method Details
#<<(instance) ⇒ Object
20 21 22 23 24 |
# File 'lib/lutaml/model/schema/xml_compiler/sequence.rb', line 20 def <<(instance) return if instance.nil? @instances << instance end |
#required_files ⇒ Object
37 38 39 |
# File 'lib/lutaml/model/schema/xml_compiler/sequence.rb', line 37 def required_files @instances.map(&:required_files) end |
#to_attributes(indent) ⇒ Object
26 27 28 |
# File 'lib/lutaml/model/schema/xml_compiler/sequence.rb', line 26 def to_attributes(indent) instances.filter_map { |instance| instance.to_attributes(indent) }.join end |
#to_xml_mapping(indent) ⇒ Object
30 31 32 33 34 35 |
# File 'lib/lutaml/model/schema/xml_compiler/sequence.rb', line 30 def to_xml_mapping(indent) content = xml_block_content(indent) return "" if content.empty? XML_MAPPING_TEMPLATE.result(binding) end |