Permalink
Browse files

Add input_array.pop!

For pry-de's ,- command.
  • Loading branch information...
1 parent 0b5b06d commit 845ea285bec2da1457366fcb4f83b5936bc49f64 @rking rking committed with rking@sharpsaw.org Sep 17, 2012
Showing with 10 additions and 0 deletions.
  1. +5 −0 lib/pry/history_array.rb
  2. +5 −0 test/test_history_array.rb
View
@@ -89,6 +89,11 @@ def to_a
((@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
@@ -59,4 +59,9 @@
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

0 comments on commit 845ea28

Please sign in to comment.