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.
30 31 32 |
# File 'lib/roby/state/shapes.rb', line 30 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.
28 29 30 |
# File 'lib/roby/state/shapes.rb', line 28 def height @height end |
#length ⇒ Object
Returns the value of attribute length.
28 29 30 |
# File 'lib/roby/state/shapes.rb', line 28 def length @length end |
#width ⇒ Object
Returns the value of attribute width.
28 29 30 |
# File 'lib/roby/state/shapes.rb', line 28 def width @width end |
Instance Method Details
#max_length(axis) ⇒ Object
34 35 36 37 38 39 40 |
# File 'lib/roby/state/shapes.rb', line 34 def max_length(axis) if axis == :z [length, width].max else height end end |