Class: RemoteObject
- Inherits:
-
Object
- Object
- RemoteObject
- Defined in:
- lib/kame/remocon/remote_object.rb
Instance Attribute Summary collapse
-
#turtle ⇒ Object
readonly
Returns the value of attribute turtle.
Instance Method Summary collapse
- #exec(str = nil, &block) ⇒ Object
- #exec_bulk(str = nil, &block) ⇒ Object
- #set_turtle(turtle) ⇒ Object
Instance Attribute Details
#turtle ⇒ Object (readonly)
Returns the value of attribute turtle.
4 5 6 |
# File 'lib/kame/remocon/remote_object.rb', line 4 def turtle @turtle end |
Instance Method Details
#exec(str = nil, &block) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/kame/remocon/remote_object.rb', line 11 def exec(str = nil, &block) if @turtle @turtle.clear @turtle.reset commander = @turtle.new_commander if str commander.instance_eval str elsif block commander.instance_eval &block end end end |
#exec_bulk(str = nil, &block) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/kame/remocon/remote_object.rb', line 24 def exec_bulk(str = nil, &block) if @turtle @turtle.clear @turtle.reset commander = Commander.new if str commander.instance_eval str elsif block commander.instance_eval &block end @turtle.exec_commands(commander.commands, wait: 0) end end |
#set_turtle(turtle) ⇒ Object
6 7 8 9 |
# File 'lib/kame/remocon/remote_object.rb', line 6 def set_turtle(turtle) @turtle = turtle nil end |