Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

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

Merged
merged 2 commits into from

3 participants

@gutenye

fix #250

@eventualbuddha
Collaborator

Thanks! It'd be nice to have a test for this, too.

@gutenye

added :)

@wycats wycats merged commit ebd2137 into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Sep 7, 2012
  1. @gutenye

    'send' as a task name. #250

    gutenye authored
Commits on Sep 8, 2012
  1. @gutenye

    tests for #250

    gutenye authored
This page is out of date. Refresh to see the latest.
View
2  lib/thor/base.rb
@@ -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
4 lib/thor/task.rb
@@ -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
View
5 spec/fixtures/script.thor
@@ -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
4 spec/thor_spec.rb
@@ -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
Something went wrong with that request. Please try again.