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 = 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 37 |
# File 'lib/flo/task.rb', line 34 def call(args=[]) raise ArgumentError.new("Expected Array") unless args.is_a? Array @provider.public_send(method_sym, *merged_evaluated_args(args.dup)) end |