Sha256: a9e6a219aae74800ff9076ace47d03509ee4c2cff4908bced706ab85ed079904

Contents?: true

Size: 1.11 KB

Versions: 9

Compression:

Stored size: 1.11 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::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

9 entries across 9 versions & 1 rubygems

Version Path
vedeu-0.6.8 lib/vedeu/output/renderers/terminal.rb
vedeu-0.6.7 lib/vedeu/output/renderers/terminal.rb
vedeu-0.6.6 lib/vedeu/output/renderers/terminal.rb
vedeu-0.6.5 lib/vedeu/output/renderers/terminal.rb
vedeu-0.6.4 lib/vedeu/output/renderers/terminal.rb
vedeu-0.6.3 lib/vedeu/output/renderers/terminal.rb
vedeu-0.6.2 lib/vedeu/output/renderers/terminal.rb
vedeu-0.6.1 lib/vedeu/output/renderers/terminal.rb
vedeu-0.6.0 lib/vedeu/output/renderers/terminal.rb