Class: Linear1::PointSlope

Inherits:
Function show all
Defined in:
lib/linear1/point_slope.rb

Instance Attribute Summary collapse

Attributes inherited from Function

#power, #slope, #y_intercept

Class Method Summary collapse

Instance Method Summary collapse

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

#x1Object (readonly)

Returns the value of attribute x1.



4
5
6
# File 'lib/linear1/point_slope.rb', line 4

def x1
  @x1
end

#y1Object (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_interceptObject 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_standardObject



18
19
20
# File 'lib/linear1/point_slope.rb', line 18

def to_standard
	to_si.to_standard
end