mirror of
https://github.com/pry/pry.git
synced 2022-11-09 12:35:05 -05:00
lib/pry/commands/ls/methods*: move #below_ceiling
Since it's used only in one place, it shouldn't be in the module. Also, add the missing switch.
This commit is contained in:
parent
f9a99d8fe8
commit
5a68874a6c
2 changed files with 16 additions and 14 deletions
|
@ -18,6 +18,7 @@ class Pry
|
|||
@ppp_switch = opts[:ppp]
|
||||
@jruby_switch = opts['all-java']
|
||||
@quiet_switch = opts[:quiet]
|
||||
@verbose_switch = opts[:verbose]
|
||||
end
|
||||
|
||||
def correct_opts?
|
||||
|
@ -35,6 +36,21 @@ class Pry
|
|||
end.join('')
|
||||
end
|
||||
|
||||
# Get a lambda that can be used with `take_while` to prevent over-eager
|
||||
# traversal of the Object's ancestry graph.
|
||||
def below_ceiling
|
||||
ceiling = if @quiet_switch
|
||||
[Pry::Method.safe_send(interrogatee_mod, :ancestors)[1]] +
|
||||
Pry.config.ls.ceiling
|
||||
elsif @verbose_switch
|
||||
[]
|
||||
else
|
||||
Pry.config.ls.ceiling.dup
|
||||
end
|
||||
lambda { |klass| !ceiling.include?(klass) }
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -23,20 +23,6 @@ module Pry::Command::Ls::MethodsHelper
|
|||
end
|
||||
end
|
||||
|
||||
# Get a lambda that can be used with `take_while` to prevent over-eager
|
||||
# traversal of the Object's ancestry graph.
|
||||
def below_ceiling
|
||||
ceiling = if @quiet_switch
|
||||
[Pry::Method.safe_send(interrogatee_mod, :ancestors)[1]] +
|
||||
Pry.config.ls.ceiling
|
||||
elsif @verbose_switch
|
||||
[]
|
||||
else
|
||||
Pry.config.ls.ceiling.dup
|
||||
end
|
||||
lambda { |klass| !ceiling.include?(klass) }
|
||||
end
|
||||
|
||||
def format(methods)
|
||||
methods.sort_by(&:name).map do |method|
|
||||
if method.name == 'method_missing'
|
||||
|
|
Loading…
Add table
Reference in a new issue