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
3 4 5 |
# File 'lib/torque/postgresql/adapter/oid/line.rb', line 3 def intercept @intercept end |
#slope ⇒ Object
Returns the value of attribute slope
3 4 5 |
# File 'lib/torque/postgresql/adapter/oid/line.rb', line 3 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
7 8 9 10 11 |
# File 'lib/torque/postgresql/adapter/oid/line.rb', line 7 def a=(value) self.slope = vertical? \ ? Float::INFINITY \ : Rational(value, b) end |
#b ⇒ Object
23 24 25 |
# File 'lib/torque/postgresql/adapter/oid/line.rb', line 23 def b vertical? ? 0 : slope.denominator end |
#b=(value) ⇒ Object
17 18 19 20 21 |
# 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
27 28 29 |
# File 'lib/torque/postgresql/adapter/oid/line.rb', line 27 def horizontal? slope.zero? end |
#vertical? ⇒ Boolean
31 32 33 |
# File 'lib/torque/postgresql/adapter/oid/line.rb', line 31 def vertical? !slope.try(:infinite?).eql?(nil) end |