Sha256: e0d69cd8ed754004a7260f1a6a085cac2d22c19c5ba2012c9cd5735e94cea883

Contents?: true

Size: 937 Bytes

Versions: 12

Compression:

Stored size: 937 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
        Vedeu.direct_write(writable_data)
      end

      private

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

      # @return [String]
      def writable_data
        return write_file if write_file?

        content
      end

    end # Terminal

  end # Renderers

end # Vedeu

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
vedeu-0.8.23 lib/vedeu/renderers/terminal.rb
vedeu-0.8.22 lib/vedeu/renderers/terminal.rb
vedeu-0.8.21 lib/vedeu/renderers/terminal.rb
vedeu-0.8.20 lib/vedeu/renderers/terminal.rb
vedeu-0.8.19 lib/vedeu/renderers/terminal.rb
vedeu-0.8.18 lib/vedeu/renderers/terminal.rb
vedeu-0.8.17 lib/vedeu/renderers/terminal.rb
vedeu-0.8.16 lib/vedeu/renderers/terminal.rb
vedeu-0.8.15 lib/vedeu/renderers/terminal.rb
vedeu-0.8.14 lib/vedeu/renderers/terminal.rb
vedeu-0.8.13 lib/vedeu/renderers/terminal.rb
vedeu-0.8.12 lib/vedeu/renderers/terminal.rb