Sha256: 5ad576d7f29abe3b4d5850a20238847f8eecaa1e448e93bf13101d21a2feca4f

Contents?: true

Size: 709 Bytes

Versions: 14

Compression:

Stored size: 709 Bytes

Contents

module Vedeu

  module Renderers

    # A renderer which returns the escape sequence for each character.
    #
    class EscapeSequence

      include Vedeu::RendererOptions

      # Returns a new instance of Vedeu::Renderers::EscapeSequence.
      #
      # @param options [Hash]
      def initialize(options = {})
        @options = options || {}
      end

      # Render the output with the escape sequences escaped.
      #
      # @param output [Array<Array<Vedeu::Char>>]
      # @return [String]
      def render(output)
        @parsed ||= Array(output).flatten.map do |char|
          Esc.escape(char.to_s) + "\n"
        end.join
      end

    end # EscapeSequence

  end # Renderers

end # Vedeu

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
vedeu-0.5.4 lib/vedeu/output/renderers/escape_sequence.rb
vedeu-0.5.3 lib/vedeu/output/renderers/escape_sequence.rb
vedeu-0.5.2 lib/vedeu/output/renderers/escape_sequence.rb
vedeu-0.5.1 lib/vedeu/output/renderers/escape_sequence.rb
vedeu-0.5.0 lib/vedeu/output/renderers/escape_sequence.rb
vedeu-0.4.65 lib/vedeu/output/renderers/escape_sequence.rb
vedeu-0.4.64 lib/vedeu/output/renderers/escape_sequence.rb
vedeu-0.4.63 lib/vedeu/output/renderers/escape_sequence.rb
vedeu-0.4.62 lib/vedeu/output/renderers/escape_sequence.rb
vedeu-0.4.61 lib/vedeu/output/renderers/escape_sequence.rb
vedeu-0.4.60 lib/vedeu/output/renderers/escape_sequence.rb
vedeu-0.4.59 lib/vedeu/output/renderers/escape_sequence.rb
vedeu-0.4.58 lib/vedeu/output/renderers/escape_sequence.rb
vedeu-0.4.57 lib/vedeu/output/renderers/escape_sequence.rb