Method: Asynchro::State#method_missing

Defined in:
lib/asynchro/state.rb

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

This lets the object instance function as a simple DSL by allowing arbitrary method names to map to various functions.



54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/asynchro/state.rb', line 54

def method_missing(name, *args, &block)
  name_s = name.to_s
  
  if (args.empty?)
    case (name)
    when /\?$/
      self.declared?(name_s.sub(/\?$/, ''))
    when /\!$/
      self.run!(name_s.sub(/\!$/, ''))
    else
      self.declare(name, &block)
    end
  else
    super(name, *args)
  end
end