Class: Coppy::Manifesto::Builder

Inherits:
Object
  • Object
show all
Defined in:
lib/coppy/manifesto.rb

Instance Method Summary collapse

Constructor Details

#initialize(dsl, manifesto) ⇒ Builder

Returns a new instance of Builder.



26
27
28
29
# File 'lib/coppy/manifesto.rb', line 26

def initialize(dsl, manifesto)
  @manifesto = manifesto
  @dsl = dsl
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args, &block) ⇒ Object



31
32
33
34
35
36
# File 'lib/coppy/manifesto.rb', line 31

def method_missing(name, *args, &block)
  unless step = @dsl.step(name)
    raise InvalidManifesto, "Unknown step #{name}"
  end
  @manifesto.steps << step.new(*args, &block)
end

Instance Method Details

#respond_to_missing?(name, private = false) ⇒ Boolean

Returns:

  • (Boolean)


38
39
40
# File 'lib/coppy/manifesto.rb', line 38

def respond_to_missing?(name, private = false)
  !!@dsl.step(name) || super
end