Class: BoxPacker::Box
- Inherits:
-
Object
- Object
- BoxPacker::Box
- Extended by:
- Forwardable
- Defined in:
- lib/box_packer/box.rb
Instance Attribute Summary collapse
-
#dimensions ⇒ Object
Returns the value of attribute dimensions.
-
#position ⇒ Object
Returns the value of attribute position.
Instance Method Summary collapse
- #>=(other) ⇒ Object
-
#initialize(dimensions, opts = {}) ⇒ Box
constructor
A new instance of Box.
- #orient! ⇒ Object
- #sub_boxes(item) ⇒ Object
Constructor Details
Instance Attribute Details
#dimensions ⇒ Object
Returns the value of attribute dimensions.
15 16 17 |
# File 'lib/box_packer/box.rb', line 15 def dimensions @dimensions end |
#position ⇒ Object
Returns the value of attribute position.
15 16 17 |
# File 'lib/box_packer/box.rb', line 15 def position @position end |
Instance Method Details
#>=(other) ⇒ Object
21 22 23 |
# File 'lib/box_packer/box.rb', line 21 def >=(other) dimensions >= other.dimensions end |
#orient! ⇒ Object
17 18 19 |
# File 'lib/box_packer/box.rb', line 17 def orient! @dimensions = Dimensions[*dimensions.to_a.sort!.reverse!] end |