Class: Torque::PostgreSQL::Circle

Inherits:
Struct
  • Object
show all
Defined in:
lib/torque/postgresql/adapter/oid/circle.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#rObject Also known as: radius

Returns the value of attribute r

Returns:

  • (Object)

    the current value of r



5
6
7
# File 'lib/torque/postgresql/adapter/oid/circle.rb', line 5

def r
  @r
end

#xObject

Returns the value of attribute x

Returns:

  • (Object)

    the current value of x



5
6
7
# File 'lib/torque/postgresql/adapter/oid/circle.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/torque/postgresql/adapter/oid/circle.rb', line 5

def y
  @y
end

Instance Method Details

#centerObject



9
10
11
# File 'lib/torque/postgresql/adapter/oid/circle.rb', line 9

def center
  point_class.new(x, y)
end

#center=(value) ⇒ Object



13
14
15
16
17
# File 'lib/torque/postgresql/adapter/oid/circle.rb', line 13

def center=(value)
  parts = value.is_a?(point_class) ? [value.x, value.y] : value[0..1]
  self.x = parts.first
  self.y = parts.last
end