Class: Symbolic::Method
- Inherits:
-
Operatable
- Object
- Operatable
- Symbolic::Method
- Defined in:
- lib/symbolic/method.rb
Instance Method Summary collapse
-
#initialize(variable, operation) ⇒ Method
constructor
A new instance of Method.
- #to_s ⇒ Object
- #undefined_variables ⇒ Object
- #value ⇒ Object
Methods inherited from Operatable
Constructor Details
#initialize(variable, operation) ⇒ Method
Returns a new instance of Method.
3 4 5 |
# File 'lib/symbolic/method.rb', line 3 def initialize(variable, operation) @variable, @operation = variable, operation end |
Instance Method Details
#to_s ⇒ Object
7 8 9 |
# File 'lib/symbolic/method.rb', line 7 def to_s "#{@operation}(#{@variable})" end |
#undefined_variables ⇒ Object
15 16 17 |
# File 'lib/symbolic/method.rb', line 15 def undefined_variables @variable.undefined_variables end |
#value ⇒ Object
11 12 13 |
# File 'lib/symbolic/method.rb', line 11 def value Math.send @operation, @variable.value if undefined_variables.empty? end |