class Warg::Console::History

Public Class Methods

new() click to toggle source
# File lib/warg.rb, line 278
def initialize
  @head = FirstEntry.new
end

Public Instance Methods

append(content, at: cursor_position) click to toggle source
# File lib/warg.rb, line 282
def append(content, at: cursor_position)
  entry = Entry.new(content, at)

  entry.previous_entry = @head
  @head.next_entry     = entry

  @head = entry
end
find_entry_for(content) click to toggle source
# File lib/warg.rb, line 291
def find_entry_for(content)
  current_entry = @head

  until current_entry.previous_entry.nil? || current_entry.content == content
    current_entry = current_entry.previous_entry
  end

  current_entry
end
inspect() click to toggle source
# File lib/warg.rb, line 301
def inspect
  %{#<#{self.class.name} head=#{@head}>}
end