Class: XlsFunction::Evaluators::Functions::Lambda::Function
- Inherits:
-
XlsFunction::Evaluators::FunctionEvaluator
- Object
- XlsFunction::Evaluators::FunctionEvaluator
- XlsFunction::Evaluators::Functions::Lambda::Function
- Defined in:
- lib/xls_function/evaluators/functions/lambda.rb
Instance Attribute Summary collapse
-
#calculation ⇒ Object
readonly
use in lambda.
Instance Method Summary collapse
- #eval ⇒ Object
- #eval_arglist ⇒ Object
-
#initialize(context, calculation) ⇒ Function
constructor
A new instance of Function.
Methods inherited from XlsFunction::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 ClassDictionary
Methods included from ErrorDetector
#class_info, #class_name, included, #rescue_with
Methods included from ArgumentsDefinable
Methods included from Evaluable
Constructor Details
#initialize(context, calculation) ⇒ Function
Returns a new instance of Function.
34 35 36 37 |
# File 'lib/xls_function/evaluators/functions/lambda.rb', line 34 def initialize(context, calculation) super(context) @calculation = calculation end |
Instance Attribute Details
#calculation ⇒ Object (readonly)
use in lambda
32 33 34 |
# File 'lib/xls_function/evaluators/functions/lambda.rb', line 32 def calculation @calculation end |
Instance Method Details
#eval ⇒ Object
49 50 51 52 |
# File 'lib/xls_function/evaluators/functions/lambda.rb', line 49 def eval # run with composed context calculation.evaluate(context) end |
#eval_arglist ⇒ Object
39 40 41 42 43 44 45 46 47 |
# File 'lib/xls_function/evaluators/functions/lambda.rb', line 39 def eval_arglist super return if error? # set to variant self.class.arg_definitions.each do |name, _default, _type| variant_context[name.to_s] = instance_variable_get("@#{name}") end end |