Sha256: fe5d83f2291cea81d4362b49f6eb9940c2e61a6c55d1430a39bd0e7ad09ee181

Contents?: true

Size: 728 Bytes

Versions: 4

Compression:

Stored size: 728 Bytes

Contents

module Vedeu

  module Renderers

    # A renderer which returns the escape sequence for each character.
    #
    # @api private
    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

4 entries across 4 versions & 1 rubygems

Version Path
vedeu-0.4.56 lib/vedeu/output/renderers/escape_sequence.rb
vedeu-0.4.55 lib/vedeu/output/renderers/escape_sequence.rb
vedeu-0.4.54 lib/vedeu/output/renderers/escape_sequence.rb
vedeu-0.4.53 lib/vedeu/output/renderers/escape_sequence.rb