class Rouge::Formatters::Terminal256

A formatter for 256-color terminals

Attributes

theme[R]

@private

Public Class Methods

new(theme = Themes::ThankfulEyes.new) click to toggle source

@param [Hash,Rouge::Theme] theme

the theme to render with.
# File lib/rouge/formatters/terminal256.rb, line 14
def initialize(theme = Themes::ThankfulEyes.new)
  if theme.is_a?(Rouge::Theme)
    @theme = theme
  elsif theme.is_a?(Hash)
    @theme = theme[:theme] || Themes::ThankfulEyes.new
  else
    raise ArgumentError, "invalid theme: #{theme.inspect}"
  end
end

Public Instance Methods

stream(tokens, &b) click to toggle source
# File lib/rouge/formatters/terminal256.rb, line 24
def stream(tokens, &b)
  tokens.each do |tok, val|
    escape_sequence(tok).stream_value(val, &b)
  end
end