diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/reline/kill_ring.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/reline/kill_ring.rb b/lib/reline/kill_ring.rb index 842fd04697..bb3684b42b 100644 --- a/lib/reline/kill_ring.rb +++ b/lib/reline/kill_ring.rb @@ -1,4 +1,6 @@ class Reline::KillRing + include Enumerable + module State FRESH = :fresh CONTINUED = :continued @@ -110,4 +112,14 @@ class Reline::KillRing nil end end + + def each + start = head = @ring.head + loop do + break if head.nil? + yield head.str + head = head.backward + break if head == start + end + end end |