Class: XmlParsable::Elements::ArrayElement
- Inherits:
-
AbstractElement
- Object
- AbstractElement
- XmlParsable::Elements::ArrayElement
- Defined in:
- lib/xmlparsable/elements/array.rb
Defined Under Namespace
Classes: Array
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #close(element, value) ⇒ Object
- #finalize ⇒ Object
-
#initialize(name, attributes, parent, arguments) ⇒ ArrayElement
constructor
A new instance of ArrayElement.
- #open(name, attributes) ⇒ Object
Methods inherited from AbstractElement
Constructor Details
#initialize(name, attributes, parent, arguments) ⇒ ArrayElement
Returns a new instance of ArrayElement.
12 13 14 15 16 17 18 19 |
# File 'lib/xmlparsable/elements/array.rb', line 12 def initialize(name, attributes, parent, arguments) @name, @attributes, @parent, @elements = name, attributes, parent, Array.new @item_name = arguments[:item_name].to_s @item_type = arguments[:class] @item_args = arguments[:item] end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
10 11 12 |
# File 'lib/xmlparsable/elements/array.rb', line 10 def name @name end |
Instance Method Details
#close(element, value) ⇒ Object
27 28 29 |
# File 'lib/xmlparsable/elements/array.rb', line 27 def close(element, value) @elements << value end |
#finalize ⇒ Object
31 32 33 34 |
# File 'lib/xmlparsable/elements/array.rb', line 31 def finalize @elements.instance_variable_set(:@xmlattrs, @attributes) @parent.close(self, @elements) end |
#open(name, attributes) ⇒ Object
21 22 23 24 25 |
# File 'lib/xmlparsable/elements/array.rb', line 21 def open(name, attributes) if name == @item_name @item_type.parsable.new(name, attributes, self, @item_args) end end |