class Warg::Console::CursorPosition

Attributes

column[RW]
row[RW]

Public Class Methods

new() click to toggle source
# File lib/warg.rb, line 254
def initialize
  @row = 1
  @column = 1
end

Public Instance Methods

adjust_to(content) click to toggle source
# File lib/warg.rb, line 259
def adjust_to(content)
  last_line_length = content.last_line_length
  newline_count = content.newline_count

  if newline_count > 0
    @column = last_line_length + 1
  else
    @column += last_line_length
  end

  @row += newline_count
end
inspect() click to toggle source
# File lib/warg.rb, line 272
def inspect
  %{#<#{self.class.name} row=#{row} column=#{column}>}
end