Class: RETMX::Properties
Overview
Wraps any number of custom properties. Can be used as a child of the map, tile (when part of a tileset), layer, objectgroup and object elements.
Instance Attribute Summary collapse
-
#xml ⇒ Object
readonly
Returns the value of attribute xml.
Instance Method Summary collapse
- #[](i) ⇒ Object
- #each ⇒ Object
-
#initialize(xml) ⇒ Properties
constructor
A new instance of Properties.
Constructor Details
#initialize(xml) ⇒ Properties
Returns a new instance of Properties.
27 28 29 30 31 32 33 |
# File 'lib/retmx.rb', line 27 def initialize(xml) @xml = xml @property = {} @xml.elements.each('properties/property') {|e| @property[e.attributes['name']] = e.attributes['value'] } end |
Instance Attribute Details
#xml ⇒ Object (readonly)
Returns the value of attribute xml.
24 25 26 |
# File 'lib/retmx.rb', line 24 def xml @xml end |
Instance Method Details
#[](i) ⇒ Object
35 36 37 |
# File 'lib/retmx.rb', line 35 def [](i) @property[i] end |
#each ⇒ Object
39 40 41 |
# File 'lib/retmx.rb', line 39 def each @property.each {|i| yield i} end |