Sha256: 53de96875271a504cf3e3d00b609adcb3fbce66b1dae37b77347ffc59899cb0b

Contents?: true

Size: 914 Bytes

Versions: 5

Compression:

Stored size: 914 Bytes

Contents

# frozen_string_literal: true

module Vedeu

  module Renderers

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

      include Vedeu::Renderers::Options

      # Render a cleared output.
      #
      # @return [String]
      def clear
        Vedeu::Terminal.clear

        render('')
      end

      # Render the output (either content or clearing) to the console.
      #
      # @return [String]
      def write
        if write_file?
          Vedeu::Terminal.output(write_file)

        else
          Vedeu::Terminal.output(content)

        end
      end

      private

      # Returns the output in a compressed form if the :compression
      # option is true.
      #
      # @return [String]
      def content
        compression
      end

    end # Terminal

  end # Renderers

end # Vedeu

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
vedeu-0.8.10 lib/vedeu/renderers/terminal.rb
vedeu-0.8.9 lib/vedeu/renderers/terminal.rb
vedeu-0.8.8 lib/vedeu/renderers/terminal.rb
vedeu-0.8.7 lib/vedeu/renderers/terminal.rb
vedeu-0.8.6 lib/vedeu/renderers/terminal.rb