Sha256: afd88421995cd9aa068af2334bc58c6b70a8ea6237e95fa6d3955b257cb8122e

Contents?: true

Size: 583 Bytes

Versions: 4

Compression:

Stored size: 583 Bytes

Contents

module Vedeu
  class ClearInterface
    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.geometry.origin(index)
        line << ' ' * interface.geometry.width
        line << interface.geometry.origin(index)
      end.join
    end

    private

    attr_reader :interface

    def colours
      interface.colour.to_s
    end

    def interface_lines
      interface.geometry.height.times
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
vedeu-0.1.7 lib/vedeu/output/clear_interface.rb
vedeu-0.1.6 lib/vedeu/output/clear_interface.rb
vedeu-0.1.5 lib/vedeu/output/clear_interface.rb
vedeu-0.1.4 lib/vedeu/output/clear_interface.rb