Class: ToyRobotSim::Table

Inherits:
Object
  • Object
show all
Defined in:
lib/toy_robot_sim/table.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(width, height) ⇒ Table

Returns a new instance of Table.



5
6
7
8
# File 'lib/toy_robot_sim/table.rb', line 5

def initialize(width, height)
  @width = width
  @height = height
end

Instance Attribute Details

#heightObject (readonly)

Returns the value of attribute height.



3
4
5
# File 'lib/toy_robot_sim/table.rb', line 3

def height
  @height
end

#widthObject (readonly)

Returns the value of attribute width.



3
4
5
# File 'lib/toy_robot_sim/table.rb', line 3

def width
  @width
end

Instance Method Details

#in_range?(location) ⇒ Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/toy_robot_sim/table.rb', line 12

def in_range?(location)
  width_in_range?(location.x) && height_in_range?(location.y)
end