Class: Arrolio::Output::Region
- Inherits:
-
Object
- Object
- Arrolio::Output::Region
- Defined in:
- lib/arrolio/output/region.rb
Instance Attribute Summary collapse
-
#height ⇒ Object
readonly
Returns the value of attribute height.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#placed_boxes ⇒ Object
readonly
Returns the value of attribute placed_boxes.
-
#width ⇒ Object
readonly
Returns the value of attribute width.
-
#x ⇒ Object
readonly
Returns the value of attribute x.
-
#y ⇒ Object
readonly
Returns the value of attribute y.
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #eql?)
- #hash ⇒ Object
-
#initialize(name:, x:, y:, width:, height:, placed_boxes: []) ⇒ Region
constructor
A new instance of Region.
Constructor Details
#initialize(name:, x:, y:, width:, height:, placed_boxes: []) ⇒ Region
Returns a new instance of Region.
8 9 10 11 12 13 14 15 16 |
# File 'lib/arrolio/output/region.rb', line 8 def initialize(name:, x:, y:, width:, height:, placed_boxes: []) @name = name.to_sym @x = x.to_f @y = y.to_f @width = width.to_f @height = height.to_f @placed_boxes = Array(placed_boxes).freeze freeze end |
Instance Attribute Details
#height ⇒ Object (readonly)
Returns the value of attribute height.
6 7 8 |
# File 'lib/arrolio/output/region.rb', line 6 def height @height end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
6 7 8 |
# File 'lib/arrolio/output/region.rb', line 6 def name @name end |
#placed_boxes ⇒ Object (readonly)
Returns the value of attribute placed_boxes.
6 7 8 |
# File 'lib/arrolio/output/region.rb', line 6 def placed_boxes @placed_boxes end |
#width ⇒ Object (readonly)
Returns the value of attribute width.
6 7 8 |
# File 'lib/arrolio/output/region.rb', line 6 def width @width end |
#x ⇒ Object (readonly)
Returns the value of attribute x.
6 7 8 |
# File 'lib/arrolio/output/region.rb', line 6 def x @x end |
#y ⇒ Object (readonly)
Returns the value of attribute y.
6 7 8 |
# File 'lib/arrolio/output/region.rb', line 6 def y @y end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
18 19 20 21 22 23 |
# File 'lib/arrolio/output/region.rb', line 18 def ==(other) other.is_a?(self.class) && name == other.name && x == other.x && y == other.y && width == other.width && height == other.height && placed_boxes == other.placed_boxes end |
#hash ⇒ Object
27 28 29 |
# File 'lib/arrolio/output/region.rb', line 27 def hash [self.class, name, x, y, width, height, placed_boxes].hash end |