Class: Robotoy::Services::Move

Inherits:
Object
  • Object
show all
Defined in:
lib/robotoy/services/move.rb

Instance Method Summary collapse

Constructor Details

#initialize(robot:, table:, x_range: 1, y_range: 1) ⇒ Move

Returns a new instance of Move.



4
5
6
7
8
9
# File 'lib/robotoy/services/move.rb', line 4

def initialize(robot:, table:, x_range: 1, y_range: 1)
  @robot = robot
  @table = table
  @x_range = x_range
  @y_range = y_range
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args) ⇒ Object (private)



38
39
40
# File 'lib/robotoy/services/move.rb', line 38

def method_missing(name, *args)
  raise Robotoy::NotValidMethodError
end

Instance Method Details

#performObject



11
12
13
14
# File 'lib/robotoy/services/move.rb', line 11

def perform
  @robot.validate_if_placed
  send(@robot.orientation)
end