Class: Cube
Instance Attribute Summary collapse
-
#height ⇒ Object
Returns the value of attribute height.
-
#length ⇒ Object
Returns the value of attribute length.
-
#width ⇒ Object
Returns the value of attribute width.
Instance Method Summary collapse
-
#initialize(length, width, height) ⇒ Cube
constructor
A new instance of Cube.
- #max_length(axis) ⇒ Object
Constructor Details
#initialize(length, width, height) ⇒ Cube
Returns a new instance of Cube.
20 21 22 |
# File 'lib/roby/state/shapes.rb', line 20 def initialize(length, width, height) @length, @width, @height = length.to_f, width.to_f, height.to_f end |
Instance Attribute Details
#height ⇒ Object
Returns the value of attribute height.
19 20 21 |
# File 'lib/roby/state/shapes.rb', line 19 def height @height end |
#length ⇒ Object
Returns the value of attribute length.
19 20 21 |
# File 'lib/roby/state/shapes.rb', line 19 def length @length end |
#width ⇒ Object
Returns the value of attribute width.
19 20 21 |
# File 'lib/roby/state/shapes.rb', line 19 def width @width end |
Instance Method Details
#max_length(axis) ⇒ Object
24 25 26 27 28 29 30 |
# File 'lib/roby/state/shapes.rb', line 24 def max_length(axis) if axis == :z [length, width].max else height end end |