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
15 16 17 |
# File 'lib/torque/postgresql/adapter/oid/line.rb', line 15 def a slope.numerator end |
#a=(value) ⇒ Object
9 10 11 12 13 |
# File 'lib/torque/postgresql/adapter/oid/line.rb', line 9 def a=(value) self.slope = vertical? \ ? Float::INFINITY \ : Rational(value, b) end |
#b ⇒ Object
25 26 27 |
# File 'lib/torque/postgresql/adapter/oid/line.rb', line 25 def b vertical? ? 0 : slope.denominator end |
#b=(value) ⇒ Object
19 20 21 22 23 |
# File 'lib/torque/postgresql/adapter/oid/line.rb', line 19 def b=(value) self.slope = value.zero? \ ? Float::INFINITY \ : Rational(a, value) end |
#horizontal? ⇒ Boolean
29 30 31 |
# File 'lib/torque/postgresql/adapter/oid/line.rb', line 29 def horizontal? slope.zero? end |
#vertical? ⇒ Boolean
33 34 35 |
# File 'lib/torque/postgresql/adapter/oid/line.rb', line 33 def vertical? !slope.try(:infinite?).eql?(nil) end |