Module: PerfectShape::PointLocation
- Included in:
- Point, RectangularShape
- Defined in:
- lib/perfect_shape/point_location.rb
Overview
Point location usually represents the top-left point in a shape
Instance Attribute Summary collapse
-
#x ⇒ Object
Returns the value of attribute x.
-
#y ⇒ Object
Returns the value of attribute y.
Instance Method Summary collapse
- #first_point ⇒ Object
-
#initialize(x: 0, y: 0) ⇒ Object
Calls super before setting x,y (default: 0,0).
-
#min_x ⇒ Object
Returns x by default.
-
#min_y ⇒ Object
Returns y by default.
Instance Attribute Details
#x ⇒ Object
Returns the value of attribute x.
25 26 27 |
# File 'lib/perfect_shape/point_location.rb', line 25 def x @x end |
#y ⇒ Object
Returns the value of attribute y.
25 26 27 |
# File 'lib/perfect_shape/point_location.rb', line 25 def y @y end |
Instance Method Details
#first_point ⇒ Object
34 35 36 |
# File 'lib/perfect_shape/point_location.rb', line 34 def first_point [x, y] end |
#initialize(x: 0, y: 0) ⇒ Object
Calls super before setting x,y (default: 0,0)
28 29 30 31 32 |
# File 'lib/perfect_shape/point_location.rb', line 28 def initialize(x: 0, y: 0) super() self.x = x self.y = y end |
#min_x ⇒ Object
Returns x by default. Subclasses may override.
49 50 51 |
# File 'lib/perfect_shape/point_location.rb', line 49 def min_x x end |
#min_y ⇒ Object
Returns y by default. Subclasses may override.
54 55 56 |
# File 'lib/perfect_shape/point_location.rb', line 54 def min_y y end |