Class: Termplot::Cursors::ConsoleCursor

Inherits:
VirtualCursor show all
Includes:
Termplot::ControlChars
Defined in:
lib/termplot/cursors/console_cursor.rb

Constant Summary

Constants included from Termplot::ControlChars

Termplot::ControlChars::BACK, Termplot::ControlChars::CR, Termplot::ControlChars::DOWN, Termplot::ControlChars::FORWARD, Termplot::ControlChars::NEWLINE, Termplot::ControlChars::UP

Instance Attribute Summary

Attributes inherited from VirtualCursor

#position, #window

Instance Method Summary collapse

Methods inherited from VirtualCursor

#col, #initialize, #reset_position, #row, #writeable?

Constructor Details

This class inherits a constructor from Termplot::Cursors::VirtualCursor

Instance Method Details

#back(n = 1) ⇒ Object



20
21
22
23
# File 'lib/termplot/cursors/console_cursor.rb', line 20

def back(n = 1)
  moved = super(n)
  moved.times { print BACK }
end

#beginning_of_lineObject



35
36
37
38
# File 'lib/termplot/cursors/console_cursor.rb', line 35

def beginning_of_line
  super
  print CR
end

#col=Object



52
53
54
# File 'lib/termplot/cursors/console_cursor.rb', line 52

def col=()
  raise "Cannot set cursor position directly"
end

#down(n = 1) ⇒ Object



30
31
32
33
# File 'lib/termplot/cursors/console_cursor.rb', line 30

def down(n=1)
  moved = super(n)
  moved.times { print DOWN }
end

#forward(n = 1) ⇒ Object



15
16
17
18
# File 'lib/termplot/cursors/console_cursor.rb', line 15

def forward(n = 1)
  moved = super(n)
  moved.times { print FORWARD }
end

#new_lineObject



40
41
42
# File 'lib/termplot/cursors/console_cursor.rb', line 40

def new_line
  print NEWLINE
end

#position=Object



44
45
46
# File 'lib/termplot/cursors/console_cursor.rb', line 44

def position=()
  raise "Cannot set cursor position directly"
end

#row=Object



48
49
50
# File 'lib/termplot/cursors/console_cursor.rb', line 48

def row=()
  raise "Cannot set cursor position directly"
end

#up(n = 1) ⇒ Object



25
26
27
28
# File 'lib/termplot/cursors/console_cursor.rb', line 25

def up(n=1)
  moved = super(n)
  moved.times { print UP }
end

#write(char) ⇒ Object



8
9
10
11
12
13
# File 'lib/termplot/cursors/console_cursor.rb', line 8

def write(char)
  if writeable?
    print(char)
    super(char)
  end
end