Class: Keyremac::Item

Inherits:
Object
  • Object
show all
Includes:
Container
Defined in:
lib/keyremac/base.rb,
lib/keyremac/dump.rb

container collapse

@@identifier =
'a'

Instance Attribute Summary

Attributes included from Container

#children

container collapse

Instance Method Summary collapse

Methods included from Container

#add, #method_missing

Constructor Details

#initialize(name = nil) ⇒ Item

Returns a new instance of Item.



90
91
92
93
94
# File 'lib/keyremac/base.rb', line 90

def initialize(name = nil)
  @children = []
  @name = name || @@identifier
  @@identifier = @@identifier.succ
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Keyremac::Container

Class Method Details

.identifierObject



83
84
85
# File 'lib/keyremac/base.rb', line 83

def self.identifier
  @@identifier
end

.reset_identifierObject



86
87
88
# File 'lib/keyremac/base.rb', line 86

def self.reset_identifier
  @@identifier = 'a'
end

Instance Method Details

#dump(xml) ⇒ Object



78
79
80
81
82
83
84
85
86
# File 'lib/keyremac/dump.rb', line 78

def dump(xml)
  xml.item do
    xml.name @name
    xml.identifier "private.#{@name}"
    @children.each { |child|
      child.dump xml
    }
  end
end