The square brackets in your execute syntax confuse me. Is that a special rake syntax (that you may be using incorrectly) or do you mean to send an array with one element (a hash)?
Isn't it the same as this?
response = Rake::Task["sample"].execute([:match => "HELLO",:freq=>'100'])
Beyond that, Task#execute
expects Rake:TaskArguments.
class TaskArguments
...
# Create a TaskArgument object with a list of named arguments
# (given by :names) and a set of associated values (given by
# :values). :parent is the parent argument object.
def initialize(names, values, parent=nil)
You could use:
stuff_args = {:match => "HELLO", :freq => '100' }
Rake::Task["stuff:sample"].execute(Rake::TaskArguments.new(stuff_args.keys, stuff_args.values))
You could also use Task#invoke, which will receive basic args. Make sure you Task#reenable
if you invoke it multiple times.