Sha256: 941d7988d8295f38620f7da3af0a94fe370572c095af08f162720dd3a6803754
Contents?: true
Size: 1.38 KB
Versions: 1
Compression:
Stored size: 1.38 KB
Contents
module Vedeu class Compositor class << self def write(output = [], interface = Dummy) return if output.nil? || output.empty? new(output, interface).write end end def initialize(output = [], interface = Dummy) @output, @interface = output, interface end def write Renderer.write(composition) end private attr_reader :output, :interface def composition container = [] streams = [] output.map do |line| line.each_with_index do |stream, index| streams << clear_line(index) if stream.is_a?(String) streams << stream else streams << Directive.enact(stream) end end container << streams.join streams = [] end container end def clear_line(index) [position(vy(index), vx), (" " * width), position(vy(index), vx)].join end def vx(index = 0) geometry.vx(index) end def vy(index = 0) geometry.vy(index) end def height geometry.height end def width geometry.width end def y geometry.y end def dy geometry.dy end def x geometry.x end def dx geometry.dx end def geometry interface.geometry end def position(y, x) Position.set(y, x) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
vedeu-0.0.7 | lib/vedeu/output/compositor.rb |