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

Instance Method Summary collapse

Instance Attribute Details

#xObject

Returns the value of attribute x.



25
26
27
# File 'lib/perfect_shape/point_location.rb', line 25

def x
  @x
end

#yObject

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

#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_xObject

Returns x by default. Subclasses may override.



45
46
47
# File 'lib/perfect_shape/point_location.rb', line 45

def min_x
  x
end

#min_yObject

Returns y by default. Subclasses may override.



50
51
52
# File 'lib/perfect_shape/point_location.rb', line 50

def min_y
  y
end