Sha256: 9998b7bc2ee7eea1196e8a0783ee0623c973384d05a491798097e95b8c424e42

Contents?: true

Size: 1.09 KB

Versions: 12

Compression:

Stored size: 1.09 KB

Contents

module Vedeu

  module DSL

    # Provides methods to be used to define views.
    #
    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 [Vedeu::InvalidSyntax] The required block was not given.
      # @return [void]
      def stream(&block)
        fail Vedeu::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

12 entries across 12 versions & 1 rubygems

Version Path
vedeu-0.5.4 lib/vedeu/dsl/stream.rb
vedeu-0.5.3 lib/vedeu/dsl/stream.rb
vedeu-0.5.2 lib/vedeu/dsl/stream.rb
vedeu-0.5.1 lib/vedeu/dsl/stream.rb
vedeu-0.5.0 lib/vedeu/dsl/stream.rb
vedeu-0.4.65 lib/vedeu/dsl/stream.rb
vedeu-0.4.64 lib/vedeu/dsl/stream.rb
vedeu-0.4.63 lib/vedeu/dsl/stream.rb
vedeu-0.4.62 lib/vedeu/dsl/stream.rb
vedeu-0.4.61 lib/vedeu/dsl/stream.rb
vedeu-0.4.60 lib/vedeu/dsl/stream.rb
vedeu-0.4.59 lib/vedeu/dsl/stream.rb