1
0
Fork 0
mirror of https://github.com/pry/pry.git synced 2022-11-09 12:35:05 -05:00

Add input_array.pop!

For pry-de's ,- command.
This commit is contained in:
☈king 2012-09-17 01:20:52 -06:00 committed by rking@sharpsaw.org
parent 0b5b06d906
commit 845ea285be
2 changed files with 10 additions and 0 deletions

View file

@ -89,6 +89,11 @@ class Pry
((@count - size)...@count).map { |n| @hash[n] }
end
def pop!
@hash.delete @count - 1
@count -= 1
end
def inspect
"#<#{self.class} size=#{size} first=#{@count - size} max_size=#{max_size}>"
end

View file

@ -59,4 +59,9 @@ describe Pry::HistoryArray do
12.times { |n| @array << n }
@array.entries.compact.size.should == 10
end
it 'should pop!' do
@populated.pop!
@populated.to_a.should == [1, 2, 3]
end
end