Module: Packerman::Dsl::Node
Instance Method Summary
collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args) ⇒ Object
13
14
15
|
# File 'lib/packerman/dsl/node.rb', line 13
def method_missing(method, *args)
@_hash[method] ||= args.first
end
|
Instance Method Details
#initialize ⇒ Object
4
5
6
7
|
# File 'lib/packerman/dsl/node.rb', line 4
def initialize
@_hash = {}
@_hash[:type] = type
end
|
#to_hash ⇒ Object
17
18
19
20
|
# File 'lib/packerman/dsl/node.rb', line 17
def to_hash
keys = self.class.hash_key
@_hash.slice(*keys)
end
|
#type ⇒ Object
9
10
11
|
# File 'lib/packerman/dsl/node.rb', line 9
def type
self.class.name.demodulize.underscore
end
|