Class: XlsFunction::Evaluators::Functions::Value
- Inherits:
-
XlsFunction::Evaluators::FunctionEvaluator
- Object
- XlsFunction::Evaluators::FunctionEvaluator
- XlsFunction::Evaluators::Functions::Value
- Defined in:
- lib/xls_function/evaluators/functions/value.rb
Instance Method Summary collapse
Methods inherited from XlsFunction::Evaluators::FunctionEvaluator
#arg_list, #before_eval, #convert_to, create, #detect_error, #error?, #error_message, #eval_arglist, #eval_or_map_eval, #evaluate, #evaluate_or_self, #initialize, #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
This class inherits a constructor from XlsFunction::Evaluators::FunctionEvaluator
Instance Method Details
#cannot_convert ⇒ Object
19 20 21 22 |
# File 'lib/xls_function/evaluators/functions/value.rb', line 19 def cannot_convert = (:cannot_convert_to_number, source: source) class_info() end |
#eval ⇒ Object
9 10 11 12 13 14 15 16 17 |
# File 'lib/xls_function/evaluators/functions/value.rb', line 9 def eval # Delete comma because ruby converts '1,000' to 1. return BigDecimal(source.delete(',')) if source.is_a?(String) return source.to_d if source.respond_to?(:to_d) ::XlsFunction::ErrorValue.value!(cannot_convert) rescue TypeError, ArgumentError ::XlsFunction::ErrorValue.value!(cannot_convert) end |