Module: Packerman::Dsl::Node

Extended by:
ActiveSupport::Concern
Included in:
Builders::AmazonChroot, Builders::AmazonEbs, Builders::AmazonInstance, Builders::Docker, HashObject, Provisioners::ChefSolo, Provisioners::Shell
Defined in:
lib/packerman/dsl/node.rb

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

#initializeObject



4
5
6
7
# File 'lib/packerman/dsl/node.rb', line 4

def initialize
  @_hash = {}
  @_hash[:type] = type
end

#to_hashObject



17
18
19
20
# File 'lib/packerman/dsl/node.rb', line 17

def to_hash
  keys = self.class.hash_key
  @_hash.slice(*keys)
end

#typeObject



9
10
11
# File 'lib/packerman/dsl/node.rb', line 9

def type
  self.class.name.demodulize.underscore
end