Class: Binpack::Item
- Inherits:
-
UnrotatableItem
- Object
- UnrotatableItem
- Binpack::Item
- Defined in:
- lib/binpack.rb
Instance Attribute Summary collapse
-
#rotated ⇒ Object
readonly
Returns the value of attribute rotated.
Attributes inherited from UnrotatableItem
Instance Method Summary collapse
-
#initialize(obj, width, height, rotated = false) ⇒ Item
constructor
A new instance of Item.
- #rotate ⇒ Object
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
#rotated ⇒ Object (readonly)
Returns the value of attribute rotated.
13 14 15 |
# File 'lib/binpack.rb', line 13 def rotated @rotated end |
Instance Method Details
#rotate ⇒ Object
20 21 22 |
# File 'lib/binpack.rb', line 20 def rotate self.class.new(@obj, @height, @width, !@rotated) end |