Merge pull request #1847 from pry/pry-rails-fixes

Backport certain methods for smother transition
This commit is contained in:
Kyrylo Silin 2018-11-04 00:49:21 +08:00 committed by GitHub
commit 165a16eae6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 4 deletions

View File

@ -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

View File

@ -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