Class: Packer::Macro

Inherits:
Object
  • Object
show all
Defined in:
lib/packer/macro.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name, *args) ⇒ Object

rubocop:disable Style/MethodMissingSuper



6
7
8
9
# File 'lib/packer/macro.rb', line 6

def method_missing(method_name, *args)
  name = method_name.to_s.slice(0,1).capitalize + method_name.to_s.slice(1..-1)
  "{{ .#{name} }}"
end

Instance Method Details

#respond_to?(symbol, include_private = false) ⇒ Boolean

Returns:

  • (Boolean)


16
17
18
19
# File 'lib/packer/macro.rb', line 16

def respond_to?(symbol, include_private=false)
  # We literally respond to everything...
  true
end

#respond_to_missing?(method_name, include_private = false) ⇒ Boolean

rubocop:enable Style/MethodMissingSuper

Returns:

  • (Boolean)


12
13
14
# File 'lib/packer/macro.rb', line 12

def respond_to_missing?(method_name, include_private = false)
  true
end