Sha256: 9a5215b11f8e9bf2e418a91dd0596ee7a1af89f3cd5303806e80a1a322e3316e

Contents?: true

Size: 710 Bytes

Versions: 1

Compression:

Stored size: 710 Bytes

Contents

module Vedeu
  class Clear

    # @param interface [Interface]
    # @return [String]
    def self.call(interface)
      new(interface).clear
    end

    # @param interface [Interface]
    # @return [Clear]
    def initialize(interface)
      @interface = interface
    end

    # @return [String]
    def clear
      rows.inject([colours]) do |line, index|
        line << interface.origin(index) { ' ' * interface.viewport_width }
      end.join
    end

    private

    attr_reader :interface

    # @api private
    # @return [String]
    def colours
      interface.colour.to_s
    end

    # @api private
    # @return [Enumerator]
    def rows
      interface.viewport_height.times
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
vedeu-0.1.18 lib/vedeu/support/clear.rb