Module: Rubot::DSL
- Defined in:
- lib/rubot/dsl.rb
Defined Under Namespace
Classes: BehaviorContext, BehaviorFactory, BehaviorFactoryBuilder, RobotBehaviorsBuilder, RobotBuilder
Constant Summary
collapse
- BehaviorFactories =
{}
- Robots =
{}
Instance Method Summary
collapse
Instance Method Details
#behavior(name, &block) ⇒ Object
146
147
148
149
150
151
|
# File 'lib/rubot/dsl.rb', line 146
def behavior(name, &block)
name, args = name.to_a.first if name.instance_of? Hash
args ||= []
bb = BehaviorFactoryBuilder.new(name, args, &block)
BehaviorFactories[name.to_sym] = bb.build
end
|
#robot(name, &block) ⇒ Object
153
154
155
156
|
# File 'lib/rubot/dsl.rb', line 153
def robot(name, &block)
rb = RobotBuilder.new(name, &block)
Robots[name.to_sym] = rb.build
end
|
#run(name) ⇒ Object
158
159
160
|
# File 'lib/rubot/dsl.rb', line 158
def run(name)
Robots[name].run
end
|