Class: ToyRobotSim::Table
- Inherits:
-
Object
- Object
- ToyRobotSim::Table
- Defined in:
- lib/toy_robot_sim/table.rb
Instance Attribute Summary collapse
-
#height ⇒ Object
readonly
Returns the value of attribute height.
-
#width ⇒ Object
readonly
Returns the value of attribute width.
Instance Method Summary collapse
- #in_range?(location) ⇒ Boolean
-
#initialize(width, height) ⇒ Table
constructor
A new instance of Table.
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
#height ⇒ Object (readonly)
Returns the value of attribute height.
3 4 5 |
# File 'lib/toy_robot_sim/table.rb', line 3 def height @height end |
#width ⇒ Object (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
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 |