Class: Uh::WM::Launcher::DSL

Inherits:
Object
  • Object
show all
Defined in:
lib/uh/wm/launcher.rb

Instance Method Summary collapse

Constructor Details

#initialize(actions) ⇒ DSL

Returns a new instance of DSL.



43
44
45
46
# File 'lib/uh/wm/launcher.rb', line 43

def initialize actions
  @actions  = actions
  @messages = []
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

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



57
58
59
60
61
62
63
# File 'lib/uh/wm/launcher.rb', line 57

def method_missing m, *args, &block
  if respond_to? m
    @messages << [m, args, block]
  else
    super
  end
end

Instance Method Details

#eachObject



53
54
55
# File 'lib/uh/wm/launcher.rb', line 53

def each
  @messages.each { |m| yield *m }
end

#evaluate(instructions) ⇒ Object



48
49
50
51
# File 'lib/uh/wm/launcher.rb', line 48

def evaluate instructions
  instance_eval &instructions
  self
end

#respond_to_missing?(m, _) ⇒ Boolean

Returns:

  • (Boolean)


65
66
67
# File 'lib/uh/wm/launcher.rb', line 65

def respond_to_missing? m, _
  m == :execute! || @actions.respond_to?(m) || super
end