Sha256: 2793f8c211cc49a2e6fe14392c9f3401979a132634206d12afd14776e0b82f6c

Contents?: true

Size: 538 Bytes

Versions: 3

Compression:

Stored size: 538 Bytes

Contents

module Vedeu
  class Clear
    def self.call(interface)
      new(interface).clear
    end

    def initialize(interface)
      @interface = interface
    end

    def clear
      interface_lines.inject([colours]) do |line, index|
        line << interface.origin(index)
        line << ' ' * interface.width
        line << interface.origin(index)
      end.join
    end

    private

    attr_reader :interface

    def colours
      interface.colour.to_s
    end

    def interface_lines
      interface.height.times
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
vedeu-0.1.10 lib/vedeu/output/clear.rb
vedeu-0.1.9 lib/vedeu/output/clear.rb
vedeu-0.1.8 lib/vedeu/output/clear.rb