Class: GeneralUnits::Box::Packer
- Inherits:
-
Object
- Object
- GeneralUnits::Box::Packer
- Defined in:
- lib/general_units/derivatives/box/packer.rb
Instance Attribute Summary collapse
-
#boxes ⇒ Object
readonly
Returns the value of attribute boxes.
-
#coupled ⇒ Object
readonly
Returns the value of attribute coupled.
-
#gaps ⇒ Object
readonly
Returns the value of attribute gaps.
-
#gaps_used ⇒ Object
readonly
Returns the value of attribute gaps_used.
-
#rotated ⇒ Object
readonly
Returns the value of attribute rotated.
Instance Method Summary collapse
-
#initialize(*boxes) ⇒ Packer
constructor
A new instance of Packer.
- #inspect ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(*boxes) ⇒ Packer
Returns a new instance of Packer.
7 8 9 10 11 12 13 14 |
# File 'lib/general_units/derivatives/box/packer.rb', line 7 def initialize(*boxes) @boxes = boxes.sort_by(&:max_face).reverse @coupled = @boxes.first # first box - biggest @gaps = [] @gaps_used = [] # for test @rotated = 0 # if height > current length pack! end |
Instance Attribute Details
#boxes ⇒ Object (readonly)
Returns the value of attribute boxes.
5 6 7 |
# File 'lib/general_units/derivatives/box/packer.rb', line 5 def boxes @boxes end |
#coupled ⇒ Object (readonly)
Returns the value of attribute coupled.
5 6 7 |
# File 'lib/general_units/derivatives/box/packer.rb', line 5 def coupled @coupled end |
#gaps ⇒ Object (readonly)
Returns the value of attribute gaps.
5 6 7 |
# File 'lib/general_units/derivatives/box/packer.rb', line 5 def gaps @gaps end |
#gaps_used ⇒ Object (readonly)
Returns the value of attribute gaps_used.
5 6 7 |
# File 'lib/general_units/derivatives/box/packer.rb', line 5 def gaps_used @gaps_used end |
#rotated ⇒ Object (readonly)
Returns the value of attribute rotated.
5 6 7 |
# File 'lib/general_units/derivatives/box/packer.rb', line 5 def rotated @rotated end |
Instance Method Details
#inspect ⇒ Object
20 21 22 |
# File 'lib/general_units/derivatives/box/packer.rb', line 20 def inspect "<#{self.class.name} boxes=#{boxes.size} gaps=#{gaps.size} used=#{gaps_used.size} coupled=#{coupled}>" end |
#to_s ⇒ Object
16 17 18 |
# File 'lib/general_units/derivatives/box/packer.rb', line 16 def to_s inspect end |