Sha256: 6cd8f76bb7eb7a97f3aee8e1487b05cb8a2015ec54aa75db853a61542cd38152

Contents?: true

Size: 916 Bytes

Versions: 1

Compression:

Stored size: 916 Bytes

Contents

module Vedeu
  class View

    include Vedeu::API

    # @param object []
    # @return [Array]
    def self.render(object = nil)
      new(object).enqueue
    end

    # @param object []
    # @return [View]
    def initialize(object = nil)
      @object = object
    end

    # @return [Array]
    def enqueue
      interfaces.map { |interface| Buffers.enqueue(interface.name, interface) }
    end

    # @return [Exception]
    def render
      fail NotImplemented, 'Implement #render on your subclass of Vedeu::View.'
    end
    alias_method :output, :render

    private

    attr_reader :object

    # @api private
    # @return [Array]
    def interfaces
      composition.interfaces
    end

    # @api private
    # @return [Composition]
    def composition
      @_composition ||= Composition.new(attributes)
    end

    # @api private
    # @return []
    def attributes
      render
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
vedeu-0.1.18 lib/vedeu/support/view.rb