Class: Vedeu::Renderers::EscapeSequence

Inherits:
Object
  • Object
show all
Includes:
Options
Defined in:
lib/vedeu/output/renderers/escape_sequence.rb

Overview

A renderer which returns the escape sequence for each character.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Vedeu::Renderers::EscapeSequence

Returns a new instance of Vedeu::Renderers::EscapeSequence.



15
16
17
# File 'lib/vedeu/output/renderers/escape_sequence.rb', line 15

def initialize(options = {})
  @options = options || {}
end

Instance Attribute Details

#optionsHash<Symbol => void> (private) Originally defined in module Options

Combines the options provided at instantiation with the default values.

Instance Method Details

#clearString

Render a cleared output.



22
23
24
# File 'lib/vedeu/output/renderers/escape_sequence.rb', line 22

def clear
  ''
end

#compress?Boolean Originally defined in module Options

#defaultsHash<Symbol => void> (private) Originally defined in module Options

The default values for a new instance of this class.

#render(output) ⇒ String

Render the output with the escape sequences escaped.



30
31
32
33
34
35
36
37
38
39
40
# File 'lib/vedeu/output/renderers/escape_sequence.rb', line 30

def render(output)
  out = ''

  output.each do |row|
    row.each do |cell|
      out << Vedeu::EscapeSequences::Esc.escape(cell.to_s)
    end
  end

  out
end