Class: Holidays::Definition::Context::FunctionProcessor
- Inherits:
-
Object
- Object
- Holidays::Definition::Context::FunctionProcessor
- Defined in:
- lib/holidays/definition/context/function_processor.rb
Instance Method Summary collapse
- #call(input, func_id, desired_func_args, func_modifier = nil) ⇒ Object
-
#initialize(custom_methods_repo, proc_result_cache_repo) ⇒ FunctionProcessor
constructor
A new instance of FunctionProcessor.
Constructor Details
#initialize(custom_methods_repo, proc_result_cache_repo) ⇒ FunctionProcessor
Returns a new instance of FunctionProcessor.
7 8 9 10 |
# File 'lib/holidays/definition/context/function_processor.rb', line 7 def initialize(custom_methods_repo, proc_result_cache_repo) @custom_methods_repo = custom_methods_repo @proc_result_cache_repo = proc_result_cache_repo end |
Instance Method Details
#call(input, func_id, desired_func_args, func_modifier = nil) ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'lib/holidays/definition/context/function_processor.rb', line 12 def call(input, func_id, desired_func_args, func_modifier = nil) validate!(input, func_id, desired_func_args) function = @custom_methods_repo.find(func_id) raise Holidays::FunctionNotFound.new("Unable to find function with id '#{func_id}'") if function.nil? calculate(input, function, parse_arguments(input, desired_func_args), func_modifier) end |