Class: Belir::Equation
- Inherits:
-
Object
- Object
- Belir::Equation
- Defined in:
- lib/belir.rb
Overview
Represents an Equation with one output and multiple input values
Instance Attribute Summary collapse
-
#inputs ⇒ Object
readonly
Returns the value of attribute inputs.
-
#output ⇒ Object
readonly
Returns the value of attribute output.
Instance Method Summary collapse
- #calculate(*inputs) ⇒ Object
-
#initialize(output, *inputs, &block) ⇒ Equation
constructor
A new instance of Equation.
Constructor Details
#initialize(output, *inputs, &block) ⇒ Equation
9 10 11 12 13 |
# File 'lib/belir.rb', line 9 def initialize(output, *inputs, &block) @output = output @inputs = inputs @lambda = block end |
Instance Attribute Details
#inputs ⇒ Object (readonly)
Returns the value of attribute inputs.
7 8 9 |
# File 'lib/belir.rb', line 7 def inputs @inputs end |
#output ⇒ Object (readonly)
Returns the value of attribute output.
6 7 8 |
# File 'lib/belir.rb', line 6 def output @output end |
Instance Method Details
#calculate(*inputs) ⇒ Object
15 16 17 18 |
# File 'lib/belir.rb', line 15 def calculate(*inputs) # Note the splat (*inputs) to convert [2] => 2 @lambda.call(*inputs) end |