Sha256: 101fd612046319b0d3924d0ca96df2fe761b3305f48753d5e5ca3b27d1dd89c3
Contents?: true
Size: 1022 Bytes
Versions: 2
Compression:
Stored size: 1022 Bytes
Contents
require_relative '../support/geometry' 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 height.times.inject([]) { |line, index| line << clear_line(index) }.join end def clear_line(index) origin(index) + (' ' * width) + origin(index) end def origin(index) interface.geometry.origin(index) end def height interface.height end def width interface.width end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
vedeu-0.0.32 | lib/vedeu/output/interface_renderer.rb |
vedeu-0.0.31 | lib/vedeu/output/interface_renderer.rb |