Attributes
Read
No documentation available
Read
No documentation available
Class Methods
lib/reline/kill_ring.rb
View on GitHub
# File tmp/rubies/ruby-3.2.0/lib/reline/kill_ring.rb, line 25
def initialize(max = 1024)
@max = max
@size = 0
@head = nil # reading head of ring-shaped tape
end
No documentation available
Instance Methods
lib/reline/kill_ring.rb
View on GitHub
# File tmp/rubies/ruby-3.2.0/lib/reline/kill_ring.rb, line 31
def <<(point)
if @size.zero?
@head = point
@head.backward = @head
@head.forward = @head
@size = 1
elsif @size >= @max
tail = @head.forward
new_tail = tail.forward
@head.forward = point
point.backward = @head
new_tail.backward = point
point.forward = new_tail
@head = point
else
tail = @head.forward
@head.forward = point
point.backward = @head
tail.backward = point
point.forward = tail
@head = point
@size += 1
end
end
No documentation available
#
lib/reline/kill_ring.rb
View on GitHub
# File tmp/rubies/ruby-3.2.0/lib/reline/kill_ring.rb, line 56
def empty?
@size.zero?
end
No documentation available