Sha256: 955f7c6fe4966419a71148f21b123de53a887a811c9990a51d0b31d4996124b4

Contents?: true

Size: 1.12 KB

Versions: 1

Compression:

Stored size: 1.12 KB

Contents

module Vedeu

  module Renderers

    # Converts a grid of {Vedeu::Views::Char} objects into a stream of
    # escape sequences and content suitable for a terminal.
    #
    class Terminal

      include Vedeu::RendererOptions

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

      # @param output [Array<Array<Vedeu::Views::Char>>]
      # @return [Array<String>]
      def render(output)
        Vedeu::Terminal.output(parsed(output))
      end

      private

      # @param output [Array<Array<Vedeu::Views::Char>>]
      # @return [Array<Array<Vedeu::Views::Char>>]
      def parsed(output)
        store!(output)

        Vedeu.timer('Compression') do
          Vedeu::Output::Compressor.render(output)
        end
      end

      # @param output [Array<Array<Vedeu::Views::Char>>]
      # @return [Array<Vedeu::Views::Char>]
      def store!(output)
        Vedeu::Terminal::Content.stores(output)
      end

    end # Terminal

  end # Renderers

end # Vedeu

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
vedeu-0.6.9 lib/vedeu/output/renderers/terminal.rb