class Robotoy::Robot

Attributes

orientation[RW]
orients[RW]
x[RW]
y[RW]

Public Class Methods

new(orients: [:north, :east, :south, :west]) click to toggle source
# File lib/robotoy/robot.rb, line 5
def initialize(orients: [:north, :east, :south, :west])
  @orients = orients
end

Public Instance Methods

validate_if_placed() click to toggle source
# File lib/robotoy/robot.rb, line 9
def validate_if_placed
  raise NotPlacedError if @x.nil? || @y.nil?
end
validate_orientation(orientation:) click to toggle source
# File lib/robotoy/robot.rb, line 13
def validate_orientation(orientation:)
  raise NotValidOrientationError unless @orients.include?(orientation.downcase)
end