Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

'send' as a task name. #250 #251

Merged
merged 2 commits into from Sep 10, 2012
Jump to file or symbol
Failed to load files and symbols.
+12 −3
Split
View
@@ -74,7 +74,7 @@ def initialize(args=[], options={}, config={})
to_parse += opts.remaining unless self.class.strict_args_position?(config)
thor_args = Thor::Arguments.new(self.class.arguments)
- thor_args.parse(to_parse).each { |k,v| send("#{k}=", v) }
+ thor_args.parse(to_parse).each { |k,v| __send__("#{k}=", v) }
@args = thor_args.remaining
end
View
@@ -24,9 +24,9 @@ def run(instance, args=[])
instance.class.handle_no_task_error(name)
elsif public_method?(instance)
arity = instance.method(name).arity
- instance.send(name, *args)
+ instance.__send__(name, *args)
elsif local_method?(instance, :method_missing)
- instance.send(:method_missing, name.to_sym, *args)
+ instance.__send__(:method_missing, name.to_sym, *args)
else
instance.class.handle_no_task_error(name)
end
@@ -93,6 +93,11 @@ END
end
end
+ desc "send", "send as a task name"
+ def send
+ true
+ end
+
private
def method_missing(meth, *args)
View
@@ -414,5 +414,9 @@ def unknown(*args)
klass.start(["unknown", "--bar", "baz"]).should == []
klass.start(["unknown", "foo", "--bar", "baz"]).should == ["foo"]
end
+
+ it "send as a task name" do
+ MyScript.start(["send"]).should == true
+ end
end
end