Sha256: e3464ad4bc0ebf46c0e70b4967b818f73e40ccfdcc419b8ca1da3c1ecfb3f338

Contents?: true

Size: 622 Bytes

Versions: 2

Compression:

Stored size: 622 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

    def colours
      interface.colour.to_s
    end

    def rows
      interface.viewport_height.times
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
vedeu-0.1.17 lib/vedeu/support/clear.rb
vedeu-0.1.16 lib/vedeu/support/clear.rb