diff options
Diffstat (limited to 'lib/bundler/vendor/thor/task.rb')
-rw-r--r-- | lib/bundler/vendor/thor/task.rb | 20 |
1 files changed, 2 insertions, 18 deletions
diff --git a/lib/bundler/vendor/thor/task.rb b/lib/bundler/vendor/thor/task.rb index f94d5b6b..6db3b608 100644 --- a/lib/bundler/vendor/thor/task.rb +++ b/lib/bundler/vendor/thor/task.rb @@ -18,15 +18,8 @@ class Thor # By default, a task invokes a method in the thor class. You can change this # implementation to create custom tasks. def run(instance, args=[]) - if private_method?(instance) - instance.class.handle_no_task_error(name) - elsif public_method?(instance) - instance.send(name, *args) - elsif local_method?(instance, :method_missing) - instance.send(:method_missing, name.to_sym, *args) - else - instance.class.handle_no_task_error(name) - end + public_method?(instance) ? + instance.send(name, *args) : instance.class.handle_no_task_error(name) rescue ArgumentError => e handle_argument_error?(instance, e, caller) ? instance.class.handle_argument_error(self, e) : (raise e) @@ -77,15 +70,6 @@ class Thor !(instance.public_methods & [name.to_s, name.to_sym]).empty? end - def private_method?(instance) - !(instance.private_methods & [name.to_s, name.to_sym]).empty? - end - - def local_method?(instance, name) - methods = instance.public_methods(false) + instance.private_methods(false) + instance.protected_methods(false) - !(methods & [name.to_s, name.to_sym]).empty? - end - def sans_backtrace(backtrace, caller) #:nodoc: saned = backtrace.reject { |frame| frame =~ FILE_REGEXP } saned -= caller |