Class: Torque::PostgreSQL::Line
- Inherits:
-
Struct
- Object
- Struct
- Torque::PostgreSQL::Line
- Defined in:
- lib/torque/postgresql/adapter/oid/line.rb
Instance Attribute Summary collapse
-
#intercept ⇒ Object
(also: #c)
Returns the value of attribute intercept.
-
#slope ⇒ Object
Returns the value of attribute slope.
Instance Method Summary collapse
- #a ⇒ Object
- #a=(value) ⇒ Object
- #b ⇒ Object
- #b=(value) ⇒ Object
- #horizontal? ⇒ Boolean
- #vertical? ⇒ Boolean
Instance Attribute Details
#intercept ⇒ Object Also known as: c
Returns the value of attribute intercept
5 6 7 |
# File 'lib/torque/postgresql/adapter/oid/line.rb', line 5 def intercept @intercept end |
#slope ⇒ Object
Returns the value of attribute slope
5 6 7 |
# File 'lib/torque/postgresql/adapter/oid/line.rb', line 5 def slope @slope end |
Instance Method Details
#a ⇒ Object
13 14 15 |
# File 'lib/torque/postgresql/adapter/oid/line.rb', line 13 def a slope.numerator end |
#a=(value) ⇒ Object
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 ⇒ Object
21 22 23 |
# File 'lib/torque/postgresql/adapter/oid/line.rb', line 21 def b vertical? ? 0 : slope.denominator end |
#b=(value) ⇒ Object
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
25 26 27 |
# File 'lib/torque/postgresql/adapter/oid/line.rb', line 25 def horizontal? slope.zero? end |
#vertical? ⇒ Boolean
29 30 31 |
# File 'lib/torque/postgresql/adapter/oid/line.rb', line 29 def vertical? !slope.try(:infinite?).eql?(nil) end |