Class: BinPacking::ScoreBoardEntry
- Inherits:
-
Object
- Object
- BinPacking::ScoreBoardEntry
- Defined in:
- lib/bin_packing/score_board_entry.rb
Instance Attribute Summary collapse
-
#bin ⇒ Object
readonly
Returns the value of attribute bin.
-
#box ⇒ Object
readonly
Returns the value of attribute box.
-
#score ⇒ Object
readonly
Returns the value of attribute score.
Instance Method Summary collapse
- #calculate ⇒ Object
- #fit? ⇒ Boolean
-
#initialize(bin, box) ⇒ ScoreBoardEntry
constructor
A new instance of ScoreBoardEntry.
Constructor Details
#initialize(bin, box) ⇒ ScoreBoardEntry
Returns a new instance of ScoreBoardEntry.
5 6 7 8 9 |
# File 'lib/bin_packing/score_board_entry.rb', line 5 def initialize(bin, box) @bin = bin @box = box @score = nil end |
Instance Attribute Details
#bin ⇒ Object (readonly)
Returns the value of attribute bin.
3 4 5 |
# File 'lib/bin_packing/score_board_entry.rb', line 3 def bin @bin end |
#box ⇒ Object (readonly)
Returns the value of attribute box.
3 4 5 |
# File 'lib/bin_packing/score_board_entry.rb', line 3 def box @box end |
#score ⇒ Object (readonly)
Returns the value of attribute score.
3 4 5 |
# File 'lib/bin_packing/score_board_entry.rb', line 3 def score @score end |
Instance Method Details
#calculate ⇒ Object
11 12 13 |
# File 'lib/bin_packing/score_board_entry.rb', line 11 def calculate @score = @bin.score_for(@box) end |
#fit? ⇒ Boolean
15 16 17 |
# File 'lib/bin_packing/score_board_entry.rb', line 15 def fit? !@score.is_blank? end |