Class: ToyRobot::Controller

Inherits:
Object
  • Object
show all
Defined in:
lib/toy_robot/controller.rb

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ Controller

Returns a new instance of Controller.



3
4
5
6
# File 'lib/toy_robot/controller.rb', line 3

def initialize(args)
  @robot = args[:robot]
  @view = args[:view]
end

Instance Method Details

#left(*_) ⇒ Object



16
17
18
# File 'lib/toy_robot/controller.rb', line 16

def left(*_)
  robot.left
end

#move(*_) ⇒ Object



12
13
14
# File 'lib/toy_robot/controller.rb', line 12

def move(*_)
  robot.move
end

#place(*args) ⇒ Object



8
9
10
# File 'lib/toy_robot/controller.rb', line 8

def place(*args)
  robot.place(*args)
end

#report(*_) ⇒ Object



24
25
26
# File 'lib/toy_robot/controller.rb', line 24

def report(*_)
  view.report
end

#right(*_) ⇒ Object



20
21
22
# File 'lib/toy_robot/controller.rb', line 20

def right(*_)
  robot.right
end