Sha256: 82f9ee1ff8a462d4de382185d6fede14036195cfadd8c7bae13eb244cfa8db14
Contents?: true
Size: 1.31 KB
Versions: 1
Compression:
Stored size: 1.31 KB
Contents
module Vedeu # Attempts to convert the provided interface object with associated lines, # streams, colours, styles, etc, into a single string containing all content # and escape sequences. # # @api private class Render extend Forwardable def_delegators :interface, :viewport # Create a new instance of Render with the provided {Vedeu::Interface} and # then convert the interface into a single string of content and escape # sequences. # # @param interface [Interface] # @return [String] def self.call(interface) new(interface).render end # Return a new instance of Render. # # @param interface [Interface] # @return [Render] def initialize(interface) @interface = interface end # Produces a single string which contains all content and escape sequences # required to render this interface to a position in the terminal window. # # @return [String] def render out = [ Clear.call(interface) ] Vedeu.log("Rendering view: '#{interface.name}'") viewport.each_with_index do |line, index| out << interface.origin(index) out << line.join end out << interface.cursor.to_s if interface.in_focus? out.join end private attr_reader :interface end # Render end # Vedeu
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
vedeu-0.2.4 | lib/vedeu/output/render.rb |