Skip to content

Commit

Permalink
Allow ls -c <anything> [Fixes pry#891]
Browse files Browse the repository at this point in the history
  • Loading branch information
ConradIrwin committed Mar 28, 2013
1 parent 3546a3a commit 00fce1b
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions lib/pry/commands/ls.rb
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,6 @@ def raise_errors_if_arguments_are_weird
["-g does not make sense with a specified Object", :globals, !args.empty?],
["-q does not make sense with -v", :quiet, opts.present?(:verbose)],
["-M only makes sense with a Module or a Class", :'instance-methods', !interrogating_a_module?],
["-c only makes sense with a Module or a Class", :constants, !args.empty? && !interrogating_a_module?],
].each do |message, option, expression|
raise Pry::CommandError, message if opts.present?(option) && expression
end
Expand All @@ -197,7 +196,7 @@ def write_out_globals
def write_out_constants
return unless opts.present?(:constants) || (!has_user_specified_any_options && interrogating_a_module?)

mod = interrogating_a_module? ? object_to_interrogate : Object
mod = interrogating_a_module? ? object_to_interrogate : object_to_interrogate.class
constants = WrappedModule.new(mod).constants(opts.present?(:verbose))
output_section("constants", grep[format_constants(mod, constants)])
end
Expand Down

0 comments on commit 00fce1b

Please sign in to comment.