Sha256: f63049d35a772fc5e2b5ae0e24ef92fdc95090c36c955529f2d0eaf187dc32d7

Contents?: true

Size: 1.1 KB

Versions: 37

Compression:

Stored size: 1.1 KB

Contents

module Vedeu

  module DSL

    # Provides methods to be used to define views.
    #
    # @api public
    class Stream

      include Vedeu::DSL
      include Vedeu::DSL::Presentation
      include Vedeu::DSL::Text

      # Returns an instance of DSL::Stream.
      #
      # @param model [Vedeu::Stream]
      # @param client [Object]
      # @return [Vedeu::DSL::Stream]
      def initialize(model, client = nil)
        @model  = model
        @client = client
      end

      # @param block [Proc]
      # @raise [InvalidSyntax] The required block was not given.
      # @return [void]
      def stream(&block)
        fail InvalidSyntax, 'block not given' unless block_given?

        model.add(model.class.build(attributes, &block))
      end

      protected

      # @!attribute [r] client
      # @return [Object]
      attr_reader :client

      # @!attribute [r] model
      # @return [Stream]
      attr_reader :model

      private

      # @return [Hash]
      def attributes
        {
          client: client,
          parent: model.parent,
        }
      end

    end # Stream

  end # DSL

end # Vedeu

Version data entries

37 entries across 37 versions & 1 rubygems

Version Path
vedeu-0.4.55 lib/vedeu/dsl/stream.rb
vedeu-0.4.54 lib/vedeu/dsl/stream.rb
vedeu-0.4.53 lib/vedeu/dsl/stream.rb
vedeu-0.4.52 lib/vedeu/dsl/stream.rb
vedeu-0.4.51 lib/vedeu/dsl/stream.rb
vedeu-0.4.50 lib/vedeu/dsl/stream.rb
vedeu-0.4.49 lib/vedeu/dsl/stream.rb
vedeu-0.4.48 lib/vedeu/dsl/stream.rb
vedeu-0.4.47 lib/vedeu/dsl/stream.rb
vedeu-0.4.46 lib/vedeu/dsl/stream.rb
vedeu-0.4.45 lib/vedeu/dsl/stream.rb
vedeu-0.4.44 lib/vedeu/dsl/stream.rb
vedeu-0.4.43 lib/vedeu/dsl/stream.rb
vedeu-0.4.42 lib/vedeu/dsl/stream.rb
vedeu-0.4.41 lib/vedeu/dsl/stream.rb
vedeu-0.4.40 lib/vedeu/dsl/stream.rb
vedeu-0.4.39 lib/vedeu/dsl/stream.rb
vedeu-0.4.38 lib/vedeu/dsl/stream.rb
vedeu-0.4.37 lib/vedeu/dsl/stream.rb
vedeu-0.4.36 lib/vedeu/dsl/stream.rb