Class: Torque::PostgreSQL::Line

Inherits:
Struct
  • Object
show all
Defined in:
lib/torque/postgresql/adapter/oid/line.rb,
sig/torque/postgresql/adapter/oid/line.rbs

Direct Known Subclasses

ActiveRecord::Line

Instance Method Summary collapse

Instance Method Details

#a ⇒ Numeric

Returns:

  • (Numeric)


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

def a
  slope.numerator
end

#a=(value) ⇒ Rational, Float

Parameters:

  • value (Numeric)

Returns:



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

def a=(value)
  self.slope = vertical? ? Float::INFINITY : Rational(value, b)
end

#b ⇒ Numeric

Returns:

  • (Numeric)


21
22
23
# File 'lib/torque/postgresql/adapter/oid/line.rb', line 21

def b
  vertical? ? 0 : slope.denominator
end

#b=(value) ⇒ Rational, Float

Parameters:

  • value (Numeric)

Returns:



17
18
19
# File 'lib/torque/postgresql/adapter/oid/line.rb', line 17

def b=(value)
  self.slope = value.zero? ? Float::INFINITY : Rational(a, value)
end

#horizontal? ⇒ Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/torque/postgresql/adapter/oid/line.rb', line 25

def horizontal?
  slope.zero?
end

#intercept ⇒ Numeric Also known as: c

Returns:

  • (Numeric)


6
# File 'sig/torque/postgresql/adapter/oid/line.rbs', line 6

def intercept: () -> Numeric

#intercept= ⇒ Numeric Also known as: c=

Parameters:

  • value (Numeric)

Returns:

  • (Numeric)


7
# File 'sig/torque/postgresql/adapter/oid/line.rbs', line 7

def intercept=: (Numeric value) -> Numeric

#slope ⇒ Rational, Float

Returns:



4
# File 'sig/torque/postgresql/adapter/oid/line.rbs', line 4

def slope: () -> (Rational | Float)

#slope= ⇒ Rational, Float

Parameters:

  • value (Rational, Float)

Returns:



5
# File 'sig/torque/postgresql/adapter/oid/line.rbs', line 5

def slope=: (Rational | Float value) -> (Rational | Float)

#vertical? ⇒ Boolean

Returns:

  • (Boolean)


29
30
31
# File 'lib/torque/postgresql/adapter/oid/line.rb', line 29

def vertical?
  !slope.try(:infinite?).eql?(nil)
end