Skip to content

Commit

Permalink
Use #public_methods to check whether a command method is public, rath…
Browse files Browse the repository at this point in the history
…er than private_methods+protected_methods.

(Works around bug #204 in MacRuby)
  • Loading branch information
nerdyc authored and rleber committed Jul 3, 2011
1 parent f81578c commit 2b63499
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions lib/thor/task.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,9 @@ def required_options
@required_options ||= options.map{ |_, o| o.usage if o.required? }.compact.sort.join(" ")
end

# Given a target, checks if this class name is not a private/protected method.
# Given a target, checks if this class name is a public method.
def public_method?(instance) #:nodoc:
collection = instance.private_methods + instance.protected_methods
(collection & [name.to_s, name.to_sym]).empty?
!(instance.public_methods & [name.to_s, name.to_sym]).empty?
end

def sans_backtrace(backtrace, caller) #:nodoc:
Expand Down

0 comments on commit 2b63499

Please sign in to comment.