Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #251 from GutenYe/fix-250

'send' as a task name. #250
  • Loading branch information...
commit ebd21372679cb204ee53959e0a2cfdac0170512b 2 parents 4aecda3 + 39dc2ba
Yehuda Katz wycats authored
2  lib/thor/base.rb
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
4 lib/thor/task.rb
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
5 spec/fixtures/script.thor
View
@@ -93,6 +93,11 @@ END
end
end
+ desc "send", "send as a task name"
+ def send
+ true
+ end
+
private
def method_missing(meth, *args)
4 spec/thor_spec.rb
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
Please sign in to comment.
Something went wrong with that request. Please try again.