Class: Linear1::DirectVariation

Inherits:
SlopeIntercept show all
Defined in:
lib/linear1/direct_variation.rb

Instance Attribute Summary

Attributes inherited from Function

#power, #slope, #y_intercept

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from SlopeIntercept

#to_ps, #to_s, #to_sf

Methods inherited from Function

#direct_variation?, display_num, #execute, #to_direct_variation, #to_function, #to_s, #to_slope_intercept, #x_intercept

Constructor Details

#initialize(k = 1) ⇒ DirectVariation



10
11
12
# File 'lib/linear1/direct_variation.rb', line 10

def initialize k=1
	super display_num(k), 0
end

Class Method Details

.try_convert(object) ⇒ Object



4
5
6
7
8
9
# File 'lib/linear1/direct_variation.rb', line 4

def self.try_convert object # @param object [{#to_dv}]
	object.send case object
		when ->(obj) {obj.respond_to? :to_direct_variation} then :to_direct_variation
		when ->(obj) {obj.respond_to? :to_dv} then :to_dv
	else fail TypeError, "Could not convert #{object} to Direct Variation" end
end