class Warg::Console::History::Entry

Attributes

column_number[RW]
content[R]
last_line_length[R]
newline_count[R]
next_entry[RW]
previous_entry[RW]
row_number[RW]

Public Class Methods

new(content, cursor_position) click to toggle source
# File lib/warg.rb, line 344
def initialize(content, cursor_position)
  @content = content

  @row_number = cursor_position.row
  @column_number = cursor_position.column

  @text = @content.to_s
  @newline_count = @content.newline_count
  @last_line_length = @content.last_line_length
end

Public Instance Methods

end_column() click to toggle source
# File lib/warg.rb, line 368
def end_column
  value = 1 + @content.last_line_length

  if newline_count.zero?
    value += @column_number
  end

  value
end
end_row() click to toggle source
# File lib/warg.rb, line 364
def end_row
  @row_number + newline_count
end
inspect() click to toggle source
# File lib/warg.rb, line 382
def inspect
  %{#<#{self.class.name} row_number=#{row_number} column_number=#{column_number} content=#{content.inspect}>}
end
newline_count_diff() click to toggle source
# File lib/warg.rb, line 360
def newline_count_diff
  @content.newline_count - @newline_count
end
sync!() click to toggle source
# File lib/warg.rb, line 355
def sync!
  @text = @content.to_s
  @last_line_length = @content.last_line_length
end
to_s() click to toggle source
# File lib/warg.rb, line 378
def to_s
  @text.dup
end