Class: Reputation::Functions::Step
- Inherits:
-
Object
- Object
- Reputation::Functions::Step
- Includes:
- Mixin
- Defined in:
- lib/reputation/functions/step.rb
Instance Attribute Summary collapse
-
#a ⇒ Object
Returns the value of attribute a.
-
#c ⇒ Object
Returns the value of attribute c.
-
#k ⇒ Object
Returns the value of attribute k.
Instance Method Summary collapse
- #f(x) ⇒ Object
-
#initialize(args = {}) ⇒ Step
constructor
A new instance of Step.
Methods included from Mixin
#google_chart, #google_chart_url
Constructor Details
#initialize(args = {}) ⇒ Step
Returns a new instance of Step.
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/reputation/functions/step.rb', line 9 def initialize(args = {}) constants = { :a => -1, # lower asymptote :k => 1, # upper asymptote :c => 0.5 # point of switch }.merge( args ) @c = constants[:c] @k = constants[:k] @a = constants[:a] end |
Instance Attribute Details
#a ⇒ Object
Returns the value of attribute a.
7 8 9 |
# File 'lib/reputation/functions/step.rb', line 7 def a @a end |
#c ⇒ Object
Returns the value of attribute c.
7 8 9 |
# File 'lib/reputation/functions/step.rb', line 7 def c @c end |
#k ⇒ Object
Returns the value of attribute k.
7 8 9 |
# File 'lib/reputation/functions/step.rb', line 7 def k @k end |
Instance Method Details
#f(x) ⇒ Object
20 21 22 |
# File 'lib/reputation/functions/step.rb', line 20 def f(x) limit( x.to_f >= c.to_f ? k : a ) end |