Sha256: cfd49c60e354c64ba5d2e40fd977860817d48ca21a2f53c2d5d2c63c789f1def

Contents?: true

Size: 1001 Bytes

Versions: 2

Compression:

Stored size: 1001 Bytes

Contents

module Vedeu

  module Renderers

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

      # @param output [Array<Array<Vedeu::Char>>]
      # @return [String]
      def self.render(*output)
        new(*output).render
      end

      # Returns a new instance of Vedeu::Renderers::Terminal.
      #
      # @param output [Array<Array<Vedeu::Char>>]
      # @return [Vedeu::Renderers::Terminal]
      def initialize(*output)
        @output = output
      end

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

      protected

      # @!attribute [r] output
      # @return [Array<Array<Vedeu::Char>>]
      attr_reader :output

      private

      # @return [String]
      def parsed
        Vedeu::Timer.for(:timer, 'Compression') do
          Vedeu::Compressor.new(output).render
        end
      end

    end # Terminal

  end # Renderers

end # Vedeu

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
vedeu-0.4.29 lib/vedeu/output/renderers/terminal.rb
vedeu-0.4.28 lib/vedeu/output/renderers/terminal.rb