Sha256: 22767b1ba13abe6fd8658492087efd9637439e1b60df6cfd753d480b8a3d5ab5
Contents?: true
Size: 1.21 KB
Versions: 2
Compression:
Stored size: 1.21 KB
Contents
module Vedeu # Clears all the character data for the area defined by an interface. This # class is called every time an interface is rendered to prepare the area # for new data. # # @api private class Clear # Blanks the area defined by the interface. # # @param interface [Interface] # @return [String] def self.call(interface) new(interface).clear end # Returns a new instance of Clear. # # @param interface [Interface] # @return [Clear] def initialize(interface) @interface = interface end # For each visible line of the interface, set the foreground and background # colours to those specified when the interface was defined, then starting # write space characters over the area which the interface occupies. # # @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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
vedeu-0.2.2 | lib/vedeu/output/clear.rb |
vedeu-0.1.19 | lib/vedeu/output/clear.rb |