Sha256: f84108f7c170325f542c96fe81fca3268a71c8531adba1bff3a8e6d044223bd9
Contents?: true
Size: 902 Bytes
Versions: 1
Compression:
Stored size: 902 Bytes
Contents
module Vedeu class InterfaceRenderer def self.clear(interface) new(interface).clear end def self.render(interface) new(interface).render end def initialize(interface) @interface = interface end def clear set_colour + clear_lines end def render out = [] content_lines.each_with_index do |line, index| out << origin(index) out << line.to_s end out.join end private attr_reader :interface def content_lines interface.lines end def set_colour interface.colour.to_s end def clear_lines interface.height.times.inject([]) do |line, index| line << clear_line(index) end.join end def clear_line(index) origin(index) + (' ' * interface.width) end def origin(index) interface.origin(index) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
vedeu-0.0.34 | lib/vedeu/output/interface_renderer.rb |