Class: Binpack::Item

Inherits:
UnrotatableItem show all
Defined in:
lib/binpack.rb

Instance Attribute Summary collapse

Attributes inherited from UnrotatableItem

#height, #obj, #width

Instance Method Summary collapse

Constructor Details

#initialize(obj, width, height, rotated = false) ⇒ Item

Returns a new instance of Item.



15
16
17
18
# File 'lib/binpack.rb', line 15

def initialize(obj, width, height, rotated=false)
  super obj, width, height
  @rotated = rotated
end

Instance Attribute Details

#rotatedObject (readonly)

Returns the value of attribute rotated.



13
14
15
# File 'lib/binpack.rb', line 13

def rotated
  @rotated
end

Instance Method Details

#rotateObject



20
21
22
# File 'lib/binpack.rb', line 20

def rotate
  self.class.new(@obj, @height, @width, !@rotated)
end