class BinPacking::Box
Attributes
can_rotate[RW]
height[RW]
packed[RW]
width[RW]
x[RW]
y[RW]
Public Class Methods
new(width, height)
click to toggle source
# File lib/bin_packing/box.rb, line 5 def initialize(width, height) @width = width @height = height @x = 0 @y = 0 @packed = false @can_rotate = true end
Public Instance Methods
area()
click to toggle source
# File lib/bin_packing/box.rb, line 14 def area @area ||= @width * @height end
can_rotate?()
click to toggle source
# File lib/bin_packing/box.rb, line 22 def can_rotate? @can_rotate end
label()
click to toggle source
# File lib/bin_packing/box.rb, line 26 def label "#{@width}x#{@height} at [#{@x},#{@y}]" end
packed?()
click to toggle source
# File lib/bin_packing/box.rb, line 18 def packed? @packed end