Sha256: da4b68f5f1d94a17961be6742e972462ffc148f6970e909c39049f0acd7df23e

Contents?: true

Size: 716 Bytes

Versions: 13

Compression:

Stored size: 716 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::Views::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

13 entries across 13 versions & 1 rubygems

Version Path
vedeu-0.6.3 lib/vedeu/output/renderers/escape_sequence.rb
vedeu-0.6.2 lib/vedeu/output/renderers/escape_sequence.rb
vedeu-0.6.1 lib/vedeu/output/renderers/escape_sequence.rb
vedeu-0.6.0 lib/vedeu/output/renderers/escape_sequence.rb
vedeu-0.5.13 lib/vedeu/output/renderers/escape_sequence.rb
vedeu-0.5.12 lib/vedeu/output/renderers/escape_sequence.rb
vedeu-0.5.11 lib/vedeu/output/renderers/escape_sequence.rb
vedeu-0.5.10 lib/vedeu/output/renderers/escape_sequence.rb
vedeu-0.5.9 lib/vedeu/output/renderers/escape_sequence.rb
vedeu-0.5.8 lib/vedeu/output/renderers/escape_sequence.rb
vedeu-0.5.7 lib/vedeu/output/renderers/escape_sequence.rb
vedeu-0.5.6 lib/vedeu/output/renderers/escape_sequence.rb
vedeu-0.5.5 lib/vedeu/output/renderers/escape_sequence.rb