Class: Dotter::Dot

Inherits:
Object
  • Object
show all
Defined in:
lib/dotter/dot.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(x, y, opts = {}) ⇒ Dot

Returns a new instance of Dot.



4
5
6
7
8
# File 'lib/dotter/dot.rb', line 4

def initialize(x, y, opts = {})
  @x, @y = x, y

  @dot_color = opts.delete(:dot_color)
end

Instance Attribute Details

#dot_colorObject

Returns the value of attribute dot_color.



2
3
4
# File 'lib/dotter/dot.rb', line 2

def dot_color
  @dot_color
end

#radiusObject

Returns the value of attribute radius.



2
3
4
# File 'lib/dotter/dot.rb', line 2

def radius
  @radius
end

#xObject

Returns the value of attribute x.



2
3
4
# File 'lib/dotter/dot.rb', line 2

def x
  @x
end

#yObject

Returns the value of attribute y.



2
3
4
# File 'lib/dotter/dot.rb', line 2

def y
  @y
end

Instance Method Details

#-(other) ⇒ Object



10
11
12
13
14
15
# File 'lib/dotter/dot.rb', line 10

def -(other)
  dot = self.dup
  dot.x -= other.x
  dot.y -= other.y
  dot
end