Class: Linear1::PointSlope
- Defined in:
- lib/linear1/point_slope.rb
Instance Attribute Summary collapse
-
#x1 ⇒ Object
readonly
Returns the value of attribute x1.
-
#y1 ⇒ Object
readonly
Returns the value of attribute y1.
Attributes inherited from Function
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(x, y, slope) ⇒ PointSlope
constructor
A new instance of PointSlope.
- #to_slope_intercept ⇒ Object (also: #to_si)
- #to_standard ⇒ Object
Methods inherited from Function
#direct_variation?, #execute, #to_direct_variation, #to_s, #x_intercept
Constructor Details
#initialize(x, y, slope) ⇒ PointSlope
Returns a new instance of PointSlope.
6 7 8 9 |
# File 'lib/linear1/point_slope.rb', line 6 def initialize x, y, slope @slope, @x1, @y1 = display_num(slope), display_num(x), display_num(y) super @slope, @x1 - @y1 end |
Instance Attribute Details
#x1 ⇒ Object (readonly)
Returns the value of attribute x1.
4 5 6 |
# File 'lib/linear1/point_slope.rb', line 4 def x1 @x1 end |
#y1 ⇒ Object (readonly)
Returns the value of attribute y1.
4 5 6 |
# File 'lib/linear1/point_slope.rb', line 4 def y1 @y1 end |
Class Method Details
.find(index) ⇒ Object
10 11 12 |
# File 'lib/linear1/point_slope.rb', line 10 def self.find index new ARGV[index], ARGV[index + 1], ARGV[index + 2] end |
Instance Method Details
#to_slope_intercept ⇒ Object Also known as: to_si
13 14 15 16 |
# File 'lib/linear1/point_slope.rb', line 13 def to_slope_intercept require "linear1/slope_intercept" SlopeIntercept.new slope, y_intercept end |
#to_standard ⇒ Object
18 19 20 |
# File 'lib/linear1/point_slope.rb', line 18 def to_standard to_si.to_standard end |