Class: XlsFunction::UserDefinedFunctionFactory::ProcFunction
- Inherits:
-
Evaluators::FunctionEvaluator
- Object
- Evaluators::FunctionEvaluator
- XlsFunction::UserDefinedFunctionFactory::ProcFunction
- Defined in:
- lib/xls_function/user_defined_function_factory.rb
Instance Attribute Summary collapse
-
#custom_proc ⇒ Object
readonly
Returns the value of attribute custom_proc.
-
#evaled_arglist ⇒ Object
readonly
Returns the value of attribute evaled_arglist.
Instance Method Summary collapse
- #eval ⇒ Object
- #eval_arglist ⇒ Object
-
#initialize(context, custom_proc) ⇒ ProcFunction
constructor
A new instance of ProcFunction.
Methods inherited from Evaluators::FunctionEvaluator
#arg_list, #before_eval, #convert_to, create, #detect_error, #error?, #error_message, #eval_or_map_eval, #evaluate, #evaluate_or_self, #map_eval, to_h, #to_proc, to_proc, translated_description, #variant_context
Methods included from Evaluators::ClassDictionary
Methods included from Evaluators::ErrorDetector
#class_info, #class_name, included, #rescue_with
Methods included from Evaluators::ArgumentsDefinable
Methods included from Evaluators::Evaluable
Constructor Details
#initialize(context, custom_proc) ⇒ ProcFunction
Returns a new instance of ProcFunction.
37 38 39 40 |
# File 'lib/xls_function/user_defined_function_factory.rb', line 37 def initialize(context, custom_proc) super(context) @custom_proc = custom_proc end |
Instance Attribute Details
#custom_proc ⇒ Object (readonly)
Returns the value of attribute custom_proc.
35 36 37 |
# File 'lib/xls_function/user_defined_function_factory.rb', line 35 def custom_proc @custom_proc end |
#evaled_arglist ⇒ Object (readonly)
Returns the value of attribute evaled_arglist.
35 36 37 |
# File 'lib/xls_function/user_defined_function_factory.rb', line 35 def evaled_arglist @evaled_arglist end |
Instance Method Details
#eval ⇒ Object
54 55 56 |
# File 'lib/xls_function/user_defined_function_factory.rb', line 54 def eval custom_proc.call(*evaled_arglist) end |
#eval_arglist ⇒ Object
43 44 45 46 47 48 49 50 51 52 |
# File 'lib/xls_function/user_defined_function_factory.rb', line 43 def eval_arglist # There is no argument definition, so it evaluates as it is passed. @evaled_arglist = arg_list.map do |arg| value = evaluate_or_self(arg) detect_error(value) break if error? value end end |