Class: Polygon::Point

Inherits:
Object
  • Object
show all
Defined in:
lib/polygon/point.rb

Overview

A polygon point to represent a point inside a canvas or to build a shape

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Point

Returns a new instance of Point.



8
9
10
11
12
13
# File 'lib/polygon/point.rb', line 8

def initialize(attributes = {})
  attributes.each do |key, value|
    setter = "#{key}="
    send(setter, value) if respond_to?(setter)
  end
end

Instance Attribute Details

#xObject

Returns the value of attribute x.



6
7
8
# File 'lib/polygon/point.rb', line 6

def x
  @x
end

#yObject

Returns the value of attribute y.



6
7
8
# File 'lib/polygon/point.rb', line 6

def y
  @y
end