Sha256: 3e73cc88efe2eddbd22fc68b3789b3b0e91cf879e57802a0c6b8aa8db4a4f711

Contents?: true

Size: 838 Bytes

Versions: 4

Compression:

Stored size: 838 Bytes

Contents

module Vedeu

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

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

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

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

    private

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

    # @return [String]
    def parsed
      Vedeu::Compressor.new(output).render
    end

  end # TerminalRenderer

end # Vedeu

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
vedeu-0.4.17 lib/vedeu/output/renderers/terminal_renderer.rb
vedeu-0.4.16 lib/vedeu/output/renderers/terminal_renderer.rb
vedeu-0.4.15 lib/vedeu/output/renderers/terminal_renderer.rb
vedeu-0.4.14 lib/vedeu/output/renderers/terminal_renderer.rb