class TTYString::Cursor

point on a screen. you can move it

Attributes

col[R]
row[R]

Public Class Methods

new(row = 0, col = 0) click to toggle source
# File lib/tty_string/cursor.rb, line 8
def initialize(row = 0, col = 0)
  @row = row
  @col = col
end

Public Instance Methods

col=(value) click to toggle source
# File lib/tty_string/cursor.rb, line 18
def col=(value)
  @col = value
  @col = 0 if @col.negative?
end
down(count = 1) click to toggle source
# File lib/tty_string/cursor.rb, line 31
def down(count = 1)
  self.row += count
end
left(count = 1) click to toggle source
# File lib/tty_string/cursor.rb, line 23
def left(count = 1)
  self.col -= count
end
right(count = 1) click to toggle source
# File lib/tty_string/cursor.rb, line 35
def right(count = 1)
  self.col += count
end
row=(value) click to toggle source
# File lib/tty_string/cursor.rb, line 13
def row=(value)
  @row = value
  @row = 0 if @row.negative?
end
to_ary() click to toggle source
# File lib/tty_string/cursor.rb, line 39
def to_ary
  [row, col]
end
up(count = 1) click to toggle source
# File lib/tty_string/cursor.rb, line 27
def up(count = 1)
  self.row -= count
end