Class: ToyRobot::Simulator
- Inherits:
-
Object
- Object
- ToyRobot::Simulator
- Defined in:
- lib/toy_robot/simulator.rb
Instance Attribute Summary collapse
-
#roboto ⇒ Object
readonly
Returns the value of attribute roboto.
-
#table ⇒ Object
readonly
Returns the value of attribute table.
Instance Method Summary collapse
-
#initialize(table_size: {x: 5, y: 5}) ⇒ Simulator
constructor
A new instance of Simulator.
- #run(orders) ⇒ Object
Constructor Details
Instance Attribute Details
#roboto ⇒ Object (readonly)
Returns the value of attribute roboto.
4 5 6 |
# File 'lib/toy_robot/simulator.rb', line 4 def roboto @roboto end |
#table ⇒ Object (readonly)
Returns the value of attribute table.
4 5 6 |
# File 'lib/toy_robot/simulator.rb', line 4 def table @table end |
Instance Method Details
#run(orders) ⇒ Object
12 13 14 15 16 17 |
# File 'lib/toy_robot/simulator.rb', line 12 def run(orders) orders.each do |order| understood = @roboto.understand_order(order) @roboto.execute_order(understood) end end |