class RubyCurses::DefaultRubyRenderer

a test renderer to see how things go

Public Instance Methods

render(pad, lineno, text) click to toggle source
# File bin/mancurses, line 698
def render pad, lineno, text
  bg = :black
  fg = :white
  att = NORMAL
  cp = $datacolor
  if text =~ /^\s*# /
    fg = :red
    cp = get_color($datacolor, fg, bg)
  elsif text =~ /^\s*#/
    fg = :blue
    cp = get_color($datacolor, fg, bg)
  elsif text =~ /^\s*class /
    fg = :magenta
    cp = get_color($datacolor, fg, bg)
  elsif text =~ /^\s*def /
    fg = :yellow
    att = BOLD
    cp = get_color($datacolor, fg, bg)
  elsif text =~ /^\s*(begin|rescue|ensure|end)/
    fg = :magenta
    att = BOLD
    cp = get_color($datacolor, fg, bg)
  end
  FFI::NCurses.wattron(pad,FFI::NCurses.COLOR_PAIR(cp) | att)
  FFI::NCurses.mvwaddstr(pad, lineno, 0, text)
  FFI::NCurses.wattroff(pad,FFI::NCurses.COLOR_PAIR(cp) | att)

end