Sha256: 2e99e5807cb820a5f783d51ec5384bab94bf7012f7a3ba23f51c15d42f00398d

Contents?: true

Size: 938 Bytes

Versions: 4

Compression:

Stored size: 938 Bytes

Contents

require 'vedeu/output/renderers/all'
require 'vedeu/output/virtual_buffer'

module Vedeu

  # Sends the content to the renderers.
  #
  class Output

    # Writes content to the defined renderers.
    #
    # @return [Array|String]
    # @see #initialize
    def self.render(content)
      new(content).render
    end

    # Return a new instance of Vedeu::Output.
    #
    # @param content [Array<Array<Vedeu::Char>>]
    # @return [Output]
    def initialize(content)
      @content = content
    end

    # Send the view to the renderers.
    #
    # @return [Array]
    def render
      if Vedeu::Configuration.drb?
        Vedeu.trigger(:_drb_store_output_, content)

        Vedeu::HTMLRenderer.to_file(Vedeu::VirtualBuffer.retrieve)
      end

      Vedeu.renderers.render(content)
    end

    private

    # @!attribute [r] content
    # @return [Array<Array<Vedeu::Char>>]
    attr_reader :content

  end # Output

end # Vedeu

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
vedeu-0.4.17 lib/vedeu/output/output.rb
vedeu-0.4.16 lib/vedeu/output/output.rb
vedeu-0.4.15 lib/vedeu/output/output.rb
vedeu-0.4.14 lib/vedeu/output/output.rb