class ToyRobotSim::Table
Attributes
height[R]
width[R]
Public Class Methods
new(width, height)
click to toggle source
# File lib/toy_robot_sim/table.rb, line 5 def initialize(width, height) @width = width @height = height end
Public Instance Methods
in_range?(location)
click to toggle source
# File lib/toy_robot_sim/table.rb, line 12 def in_range?(location) width_in_range?(location.x) && height_in_range?(location.y) end
Private Instance Methods
height_in_range?(y)
click to toggle source
# File lib/toy_robot_sim/table.rb, line 24 def height_in_range?(y) y >= 0 && y <= (height - 1) end
width_in_range?(x)
click to toggle source
# File lib/toy_robot_sim/table.rb, line 20 def width_in_range?(x) x >= 0 && x <= (width - 1) end