diff options
author | Kyrylo Silin <silin@kyrylo.org> | 2018-11-04 00:49:21 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-04 00:49:21 +0800 |
commit | 165a16eae616d10f10259c791ab9047b8aedb23d (patch) | |
tree | a5599414608f619ffe5692ca490292fc96dcfa79 | |
parent | a61115ceba243e0f2eb719b9385be34c3cad6f79 (diff) | |
parent | d92f7b38791fb4154f08740817da46cfa98fedeb (diff) | |
download | pry-165a16eae616d10f10259c791ab9047b8aedb23d.tar.gz |
Merge pull request #1847 from pry/pry-rails-fixes
Backport certain methods for smother transition
-rw-r--r-- | lib/pry/pry_instance.rb | 24 | ||||
-rw-r--r-- | lib/pry/ring.rb | 1 |
2 files changed, 21 insertions, 4 deletions
diff --git a/lib/pry/pry_instance.rb b/lib/pry/pry_instance.rb index 17d61f85..385f1fda 100644 --- a/lib/pry/pry_instance.rb +++ b/lib/pry/pry_instance.rb @@ -87,17 +87,33 @@ class Pry exec_hook(:when_started, target, options, self) end + @input_array_warn = false # @deprecated Use {#input_ring} instead. def input_array - warn "[DEPRECATED] '#{self.class.name}##{__method__}' is deprecated. " \ - "Use '#{self.class.name}#input_ring' instead." + unless @input_array_warn + loc = caller_locations(1..1).first + warn( + "#{loc.path}:#{loc.lineno}: warning: method #{self.class}##{__method__} " \ + "is deprecated. Use #{self.class}#input_ring instead" + ) + @input_array_warn = true + end + @input_ring end + @output_array_warn = false # @deprecated Use {#output_ring} instead. def output_array - warn "[DEPRECATED] '#{self.class.name}##{__method__}' is deprecated. " \ - "Use '#{self.class.name}#output_ring' instead" + unless @output_array_warn + loc = caller_locations(1..1).first + warn( + "#{loc.path}:#{loc.lineno}: warning: method #{self.class}##{__method__} " \ + "is deprecated. Use #{self.class}#output_ring instead" + ) + @output_array_warn = true + end + @output_ring end diff --git a/lib/pry/ring.rb b/lib/pry/ring.rb index eb7c891a..e46256f1 100644 --- a/lib/pry/ring.rb +++ b/lib/pry/ring.rb @@ -24,6 +24,7 @@ class Pry # @return [Integer] how many objects were added during the lifetime of the # ring attr_reader :count + alias size count # @param [Integer] max_size Maximum buffer size. The buffer will start # overwriting elements once its reaches its maximum capacity |