Class: Flo::Task
- Inherits:
-
Object
- Object
- Flo::Task
- Defined in:
- lib/flo/task.rb
Overview
Definition of a task performed by a Command.
Instance Method Summary collapse
-
#call(args = {}) ⇒ #success?
Call invokes the task on the provider instance.
-
#initialize(provider, method_sym, provider_options = {}) ⇒ Task
constructor
Creates a new Task instance.
Constructor Details
#initialize(provider, method_sym, provider_options = {}) ⇒ Task
Creates a new Task instance
20 21 22 23 24 25 26 |
# File 'lib/flo/task.rb', line 20 def initialize(provider, method_sym, ={}) @provider = provider @method_sym = method_sym raise ArgumentError.new("Expected provider_options to be a hash") unless .is_a? Hash @provider_options = end |
Instance Method Details
#call(args = {}) ⇒ #success?
Call invokes the task on the provider instance. Additional parameters can be passed in that are merged into the parameters that were provided in #initialize. Proc values will be evaluated before being passed to the provider.
34 35 36 |
# File 'lib/flo/task.rb', line 34 def call(args={}) @provider.public_send(method_sym, merged_evaluated_args(args)) end |