Class: MyData::Xsd::ComplexType
- Inherits:
-
Object
- Object
- MyData::Xsd::ComplexType
- Defined in:
- lib/my_data/xsd/complex_type.rb
Instance Attribute Summary collapse
-
#doc ⇒ Object
readonly
Returns the value of attribute doc.
-
#namespace ⇒ Object
readonly
Returns the value of attribute namespace.
Instance Method Summary collapse
- #elements ⇒ Object
-
#initialize(doc, namespace: nil) ⇒ ComplexType
constructor
A new instance of ComplexType.
- #inspect ⇒ Object
- #name ⇒ Object
Constructor Details
#initialize(doc, namespace: nil) ⇒ ComplexType
Returns a new instance of ComplexType.
6 7 8 9 |
# File 'lib/my_data/xsd/complex_type.rb', line 6 def initialize(doc, namespace: nil) @doc = doc @namespace = namespace end |
Instance Attribute Details
#doc ⇒ Object (readonly)
Returns the value of attribute doc.
4 5 6 |
# File 'lib/my_data/xsd/complex_type.rb', line 4 def doc @doc end |
#namespace ⇒ Object (readonly)
Returns the value of attribute namespace.
4 5 6 |
# File 'lib/my_data/xsd/complex_type.rb', line 4 def namespace @namespace end |
Instance Method Details
#elements ⇒ Object
15 16 17 18 19 |
# File 'lib/my_data/xsd/complex_type.rb', line 15 def elements @elements ||= extract_elements(doc).flatten.map do |element| MyData::Xsd::Element.new(element) end end |
#inspect ⇒ Object
21 22 23 |
# File 'lib/my_data/xsd/complex_type.rb', line 21 def inspect "ComplexType: { name: #{name.to_json}, elements: #{elements} }" end |
#name ⇒ Object
11 12 13 |
# File 'lib/my_data/xsd/complex_type.rb', line 11 def name @name ||= doc.attributes["name"].value.camelize end |