Class: Lutaml::Model::Schema::XmlCompiler::Element
- Inherits:
-
Object
- Object
- Lutaml::Model::Schema::XmlCompiler::Element
- Defined in:
- lib/lutaml/model/schema/xml_compiler/element.rb
Instance Attribute Summary collapse
-
#default ⇒ Object
Returns the value of attribute default.
-
#fixed ⇒ Object
Returns the value of attribute fixed.
-
#id ⇒ Object
Returns the value of attribute id.
-
#max_occurs ⇒ Object
Returns the value of attribute max_occurs.
-
#min_occurs ⇒ Object
Returns the value of attribute min_occurs.
-
#name ⇒ Object
Returns the value of attribute name.
-
#ref ⇒ Object
Returns the value of attribute ref.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(name: nil, ref: nil) ⇒ Element
constructor
A new instance of Element.
- #required_files ⇒ Object
- #to_attributes(indent) ⇒ Object
- #to_xml_mapping(indent) ⇒ Object
Constructor Details
#initialize(name: nil, ref: nil) ⇒ Element
Returns a new instance of Element.
17 18 19 20 |
# File 'lib/lutaml/model/schema/xml_compiler/element.rb', line 17 def initialize(name: nil, ref: nil) @name = name @ref = ref end |
Instance Attribute Details
#default ⇒ Object
Returns the value of attribute default.
8 9 10 |
# File 'lib/lutaml/model/schema/xml_compiler/element.rb', line 8 def default @default end |
#fixed ⇒ Object
Returns the value of attribute fixed.
8 9 10 |
# File 'lib/lutaml/model/schema/xml_compiler/element.rb', line 8 def fixed @fixed end |
#id ⇒ Object
Returns the value of attribute id.
8 9 10 |
# File 'lib/lutaml/model/schema/xml_compiler/element.rb', line 8 def id @id end |
#max_occurs ⇒ Object
Returns the value of attribute max_occurs.
8 9 10 |
# File 'lib/lutaml/model/schema/xml_compiler/element.rb', line 8 def max_occurs @max_occurs end |
#min_occurs ⇒ Object
Returns the value of attribute min_occurs.
8 9 10 |
# File 'lib/lutaml/model/schema/xml_compiler/element.rb', line 8 def min_occurs @min_occurs end |
#name ⇒ Object
Returns the value of attribute name.
8 9 10 |
# File 'lib/lutaml/model/schema/xml_compiler/element.rb', line 8 def name @name end |
#ref ⇒ Object
Returns the value of attribute ref.
8 9 10 |
# File 'lib/lutaml/model/schema/xml_compiler/element.rb', line 8 def ref @ref end |
#type ⇒ Object
Returns the value of attribute type.
8 9 10 |
# File 'lib/lutaml/model/schema/xml_compiler/element.rb', line 8 def type @type end |
Instance Method Details
#required_files ⇒ Object
36 37 38 39 40 41 42 43 44 |
# File 'lib/lutaml/model/schema/xml_compiler/element.rb', line 36 def required_files return if skippable? element_type = resolved_type(change_case: false) return "require \"bigdecimal\"" if element_type == "decimal" return if SimpleType.skippable?(element_type) "require_relative \"#{Utils.snake_case(element_type)}\"" end |
#to_attributes(indent) ⇒ Object
22 23 24 25 26 27 |
# File 'lib/lutaml/model/schema/xml_compiler/element.rb', line 22 def to_attributes(indent) return if skippable? return unless resolved_type "#{indent}attribute :#{resolved_name}, :#{resolved_type}#{}\n" end |
#to_xml_mapping(indent) ⇒ Object
29 30 31 32 33 34 |
# File 'lib/lutaml/model/schema/xml_compiler/element.rb', line 29 def to_xml_mapping(indent) return if skippable? return unless resolved_type "#{indent}map_element :#{resolved_name(change_case: false)}, to: :#{resolved_name}#{render_default_option}\n" end |