Class: RETMX::Properties

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/retmx.rb

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

Instance Method Summary collapse

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

#xmlObject (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

#eachObject



39
40
41
# File 'lib/retmx.rb', line 39

def each
  @property.each {|i| yield i}
end