mirror of
https://github.com/pry/pry.git
synced 2022-11-09 12:35:05 -05:00
Added Pry#memory_size= to set the size of _in_ and _out_
This commit is contained in:
parent
b96f00cebd
commit
ee01866928
1 changed files with 12 additions and 5 deletions
|
@ -39,7 +39,7 @@ class Pry
|
||||||
attributes = [
|
attributes = [
|
||||||
:input, :output, :commands, :print,
|
:input, :output, :commands, :print,
|
||||||
:exception_handler, :hooks, :custom_completions,
|
:exception_handler, :hooks, :custom_completions,
|
||||||
:prompt
|
:prompt, :memory_size
|
||||||
]
|
]
|
||||||
|
|
||||||
attributes.each do |attribute|
|
attributes.each do |attribute|
|
||||||
|
@ -50,10 +50,6 @@ class Pry
|
||||||
send "#{key}=", value
|
send "#{key}=", value
|
||||||
end
|
end
|
||||||
|
|
||||||
size = options[:memory_size] || Pry.memory_size
|
|
||||||
@input_array = Pry::HistoryArray.new(size)
|
|
||||||
@output_array = Pry::HistoryArray.new(size)
|
|
||||||
|
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -77,6 +73,17 @@ class Pry
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# @return [Integer] The maximum amount of objects remembered by the _in_ and
|
||||||
|
# _out_ arrays. Defaults to 100.
|
||||||
|
def memory_size
|
||||||
|
@output_array.max_size
|
||||||
|
end
|
||||||
|
|
||||||
|
def memory_size=(size)
|
||||||
|
@input_array = Pry::HistoryArray.new(size)
|
||||||
|
@output_array = Pry::HistoryArray.new(size)
|
||||||
|
end
|
||||||
|
|
||||||
# Get nesting data.
|
# Get nesting data.
|
||||||
# This method should not need to be accessed directly.
|
# This method should not need to be accessed directly.
|
||||||
# @return [Array] The unparsed nesting information.
|
# @return [Array] The unparsed nesting information.
|
||||||
|
|
Loading…
Reference in a new issue