Class: Keisan::Function
- Inherits:
-
Object
- Object
- Keisan::Function
- Defined in:
- lib/keisan/function.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #call(context, *args) ⇒ Object
-
#initialize(name, function_proc) ⇒ Function
constructor
A new instance of Function.
Constructor Details
#initialize(name, function_proc) ⇒ Function
Returns a new instance of Function.
5 6 7 8 9 |
# File 'lib/keisan/function.rb', line 5 def initialize(name, function_proc) raise Keisan::Exceptions::InvalidFunctionError.new unless function_proc.is_a?(Proc) @name = name @function_proc = function_proc end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/keisan/function.rb', line 3 def name @name end |
Instance Method Details
#call(context, *args) ⇒ Object
11 12 13 |
# File 'lib/keisan/function.rb', line 11 def call(context, *args) @function_proc.call(*args) end |