Class: Archimate::Svg::Point

Inherits:
Struct
  • Object
show all
Defined in:
lib/archimate/svg/point.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#xObject

Returns the value of attribute x

Returns:

  • (Object)

    the current value of x



5
6
7
# File 'lib/archimate/svg/point.rb', line 5

def x
  @x
end

#yObject

Returns the value of attribute y

Returns:

  • (Object)

    the current value of y



5
6
7
# File 'lib/archimate/svg/point.rb', line 5

def y
  @y
end

Instance Method Details

#-(other) ⇒ Object



6
7
8
9
10
11
# File 'lib/archimate/svg/point.rb', line 6

def -(other)
  Math.sqrt(
    ((other.x - x)**2) +
    ((other.y - y)**2)
  )
end

#to_sObject



13
14
15
# File 'lib/archimate/svg/point.rb', line 13

def to_s
  [x, y].map(&:to_s).join(" ")
end