Sha256: fcb64b497541bf796a1802711b245c7f72947714cedcdf0b23d546311a75ea6d

Contents?: true

Size: 902 Bytes

Versions: 9

Compression:

Stored size: 902 Bytes

Contents

module Vedeu

  module API

    # @see Vedeu::Composition
    #
    # @api public
    class Composition < Vedeu::Composition

      # @param block [Proc]
      # @return [Array]
      # @see Vedeu::API#render
      def self.render(&block)
        fail InvalidSyntax, '`render` requires a block.' unless block_given?

        attributes = API::Composition.build({}, &block)

        Vedeu::Composition.new(attributes).interfaces.map do |interface|
          Buffers.add(interface.attributes)

          interface.name
        end.map { |name| Vedeu::Refresh.by_name(name) }
      end

      # @param name [String]
      # @param block [Proc]
      # @return [Hash]
      # @see Vedeu::API#view
      def view(name, &block)
        attributes[:interfaces] << API::Interface
          .build({ name: name, parent: self.view_attributes }, &block)
      end

    end # Composition

  end # API

end # Vedeu

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
vedeu-0.2.12 lib/vedeu/api/composition.rb
vedeu-0.2.11 lib/vedeu/api/composition.rb
vedeu-0.2.10 lib/vedeu/api/composition.rb
vedeu-0.2.9 lib/vedeu/api/composition.rb
vedeu-0.2.8 lib/vedeu/api/composition.rb
vedeu-0.2.7 lib/vedeu/api/composition.rb
vedeu-0.2.6 lib/vedeu/api/composition.rb
vedeu-0.2.5 lib/vedeu/api/composition.rb
vedeu-0.2.4 lib/vedeu/api/composition.rb