diff --git a/.travis.yml b/.travis.yml index 95574215..321fb5eb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,7 +5,7 @@ rvm: - 2.1.0 - ruby-head - rbx - - jruby-19mode + - jruby - jruby-head script: diff --git a/lib/pry/commands/ls.rb b/lib/pry/commands/ls.rb index 02f40dac..1730b16e 100644 --- a/lib/pry/commands/ls.rb +++ b/lib/pry/commands/ls.rb @@ -59,11 +59,10 @@ class Pry ls_entity = LsEntity.new({ :interrogatee => @interrogatee, - :target => target, :no_user_opts => no_user_opts?, :opts => opts, - :sticky_locals => _pry_.sticky_locals, - :args => args + :args => args, + :_pry_ => _pry_ }) stagger_output(ls_entity.entities_table) diff --git a/lib/pry/commands/ls/constants.rb b/lib/pry/commands/ls/constants.rb index 48670088..3db81624 100644 --- a/lib/pry/commands/ls/constants.rb +++ b/lib/pry/commands/ls/constants.rb @@ -3,11 +3,11 @@ require 'pry/commands/ls/interrogatable' class Pry class Command::Ls < Pry::ClassCommand class Constants < Pry::Command::Ls::Formatter - include Pry::Command::Ls::Interrogatable - def initialize(interrogatee, target, no_user_opts, opts) - super(target) + + def initialize(interrogatee, no_user_opts, opts, _pry_) + super(_pry_) @interrogatee = interrogatee @no_user_opts = no_user_opts @default_switch = opts[:constants] diff --git a/lib/pry/commands/ls/formatter.rb b/lib/pry/commands/ls/formatter.rb index e657681a..844a220f 100644 --- a/lib/pry/commands/ls/formatter.rb +++ b/lib/pry/commands/ls/formatter.rb @@ -1,11 +1,12 @@ class Pry class Command::Ls < Pry::ClassCommand class Formatter - attr_accessor :grep + attr_reader :_pry_ - def initialize(target) - @target = target + def initialize(_pry_) + @_pry_ = _pry_ + @target = _pry_.current_context end def write_out @@ -16,7 +17,7 @@ class Pry private def color(type, str) - Pry::Helpers::Text.send(Pry.config.ls.send(:"#{type}_color"), str) + Pry::Helpers::Text.send _pry_.config.ls["#{type}_color"], str end # Add a new section to the output. diff --git a/lib/pry/commands/ls/globals.rb b/lib/pry/commands/ls/globals.rb index 4a44f5f9..2b3d0fde 100644 --- a/lib/pry/commands/ls/globals.rb +++ b/lib/pry/commands/ls/globals.rb @@ -19,8 +19,8 @@ class Pry $CHILD_STATUS $SAFE $ERROR_INFO $ERROR_POSITION $LAST_MATCH_INFO $LAST_PAREN_MATCH $LAST_READ_LINE $MATCH $POSTMATCH $PREMATCH) - def initialize(target, opts) - super(target) + def initialize(opts, _pry_) + super(_pry_) @default_switch = opts[:globals] end diff --git a/lib/pry/commands/ls/instance_vars.rb b/lib/pry/commands/ls/instance_vars.rb index 23155686..2f33677f 100644 --- a/lib/pry/commands/ls/instance_vars.rb +++ b/lib/pry/commands/ls/instance_vars.rb @@ -3,10 +3,10 @@ require 'pry/commands/ls/interrogatable' class Pry class Command::Ls < Pry::ClassCommand class InstanceVars < Pry::Command::Ls::Formatter - include Pry::Command::Ls::Interrogatable - def initialize(interrogatee, no_user_opts, opts) + def initialize(interrogatee, no_user_opts, opts, _pry_) + super(_pry_) @interrogatee = interrogatee @no_user_opts = no_user_opts @default_switch = opts[:ivars] diff --git a/lib/pry/commands/ls/local_names.rb b/lib/pry/commands/ls/local_names.rb index c4240149..9d6350b5 100644 --- a/lib/pry/commands/ls/local_names.rb +++ b/lib/pry/commands/ls/local_names.rb @@ -2,11 +2,11 @@ class Pry class Command::Ls < Pry::ClassCommand class LocalNames < Pry::Command::Ls::Formatter - def initialize(target, no_user_opts, sticky_locals, args) - super(target) + def initialize(no_user_opts, args, _pry_) + super(_pry_) @no_user_opts = no_user_opts - @sticky_locals = sticky_locals @args = args + @sticky_locals = _pry_.sticky_locals end def correct_opts? diff --git a/lib/pry/commands/ls/local_vars.rb b/lib/pry/commands/ls/local_vars.rb index 9f0952ad..d48ddae7 100644 --- a/lib/pry/commands/ls/local_vars.rb +++ b/lib/pry/commands/ls/local_vars.rb @@ -2,10 +2,10 @@ class Pry class Command::Ls < Pry::ClassCommand class LocalVars < Pry::Command::Ls::Formatter - def initialize(target, sticky_locals, opts) - super(target) - @sticky_locals = sticky_locals + def initialize(opts, _pry_) + super(_pry_) @default_switch = opts[:locals] + @sticky_locals = _pry_.sticky_locals end def output_self diff --git a/lib/pry/commands/ls/ls_entity.rb b/lib/pry/commands/ls/ls_entity.rb index a8958d19..3d69bcdd 100644 --- a/lib/pry/commands/ls/ls_entity.rb +++ b/lib/pry/commands/ls/ls_entity.rb @@ -12,15 +12,15 @@ class Pry class Command::Ls < Pry::ClassCommand class LsEntity + attr_reader :_pry_ def initialize(opts) @interrogatee = opts[:interrogatee] - @target = opts[:target] @no_user_opts = opts[:no_user_opts] @opts = opts[:opts] - @sticky_locals = opts[:sticky_locals] @args = opts[:args] @grep = Grep.new(Regexp.new(opts[:opts][:G] || '.')) + @_pry_ = opts.delete(:_pry_) end def entities_table @@ -34,38 +34,37 @@ class Pry end def globals - grep(Globals.new(@target, @opts)) + grep Globals.new(@opts, _pry_) end def constants - grep(Constants.new(@interrogatee, @target, @no_user_opts, @opts)) + grep Constants.new(@interrogatee, @no_user_opts, @opts, _pry_) end def methods - grep(Methods.new(@interrogatee, @no_user_opts, @opts)) + grep(Methods.new(@interrogatee, @no_user_opts, @opts, _pry_)) end def self_methods - grep(SelfMethods.new(@interrogatee, @no_user_opts, @opts)) + grep SelfMethods.new(@interrogatee, @no_user_opts, @opts, _pry_) end def instance_vars - grep(InstanceVars.new(@interrogatee, @no_user_opts, @opts)) + grep InstanceVars.new(@interrogatee, @no_user_opts, @opts, _pry_) end def local_names - grep(LocalNames.new(@target, @no_user_opts, @sticky_locals, @args)) + grep LocalNames.new(@no_user_opts, @args, _pry_) end def local_vars - LocalVars.new(@target, @sticky_locals, @opts) + LocalVars.new(@opts, _pry_) end def entities [globals, constants, methods, self_methods, instance_vars, local_names, local_vars] end - end end end diff --git a/lib/pry/commands/ls/methods.rb b/lib/pry/commands/ls/methods.rb index 9bc108ee..c085f421 100644 --- a/lib/pry/commands/ls/methods.rb +++ b/lib/pry/commands/ls/methods.rb @@ -8,7 +8,8 @@ class Pry include Pry::Command::Ls::Interrogatable include Pry::Command::Ls::MethodsHelper - def initialize(interrogatee, no_user_opts, opts) + def initialize(interrogatee, no_user_opts, opts, _pry_) + super(_pry_) @interrogatee = interrogatee @no_user_opts = no_user_opts @default_switch = opts[:methods] @@ -42,11 +43,11 @@ class Pry def below_ceiling ceiling = if @quiet_switch [Pry::Method.safe_send(interrogatee_mod, :ancestors)[1]] + - Pry.config.ls.ceiling + _pry_.config.ls.ceiling elsif @verbose_switch [] else - Pry.config.ls.ceiling.dup + _pry_.config.ls.ceiling.dup end lambda { |klass| !ceiling.include?(klass) } end diff --git a/lib/pry/commands/ls/self_methods.rb b/lib/pry/commands/ls/self_methods.rb index cd68b227..91f3490b 100644 --- a/lib/pry/commands/ls/self_methods.rb +++ b/lib/pry/commands/ls/self_methods.rb @@ -4,11 +4,11 @@ require 'pry/commands/ls/methods_helper' class Pry class Command::Ls < Pry::ClassCommand class SelfMethods < Pry::Command::Ls::Formatter - include Pry::Command::Ls::Interrogatable include Pry::Command::Ls::MethodsHelper - def initialize(interrogatee, no_user_opts, opts) + def initialize(interrogatee, no_user_opts, opts, _pry_) + super(_pry_) @interrogatee = interrogatee @no_user_opts = no_user_opts end