Sha256: cec3227c8eaaadf125d196e777aeb0dc41665bf9a62bda48145344512f652238

Contents?: true

Size: 1.18 KB

Versions: 19

Compression:

Stored size: 1.18 KB

Contents

module Vedeu

  # Provides a mechanism to help configure and use Vedeu.
  #
  module DSL

    protected

    # @!attribute [r] client
    # @return [Object] The object instance where the DSL is being used.
    attr_reader :client

    # @!attribute [r] model
    # @return [void] The new model object which the DSL is constructing.
    attr_reader :model

    private

    # Returns the default attributes for the new model.
    #
    # @note
    #   Specific DSL classes may be overriding this method.
    #
    # @return [Hash<Symbol => void>]
    def attributes
      {
        client: client,
        parent: model,
      }
    end

    # :nocov:
    # Attempts to find the missing method on the client object.
    #
    # @param method [Symbol] The name of the method sought.
    # @param args [Array] The arguments which the method was to be invoked with.
    # @param block [Proc] The optional block provided to the method.
    # @return [void]
    def method_missing(method, *args, &block)
      Vedeu.log(type:    :debug,
                message: "!!!method_missing '#{method}' (#{client.inspect})")

      client.send(method, *args, &block) if client
    end
    # :nocov:

  end # DSL

end # Vedeu

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
vedeu-0.6.10 lib/vedeu/dsl/dsl.rb
vedeu-0.6.9 lib/vedeu/dsl/dsl.rb
vedeu-0.6.8 lib/vedeu/dsl/dsl.rb
vedeu-0.6.7 lib/vedeu/dsl/dsl.rb
vedeu-0.6.6 lib/vedeu/dsl/dsl.rb
vedeu-0.6.5 lib/vedeu/dsl/dsl.rb
vedeu-0.6.4 lib/vedeu/dsl/dsl.rb
vedeu-0.6.3 lib/vedeu/dsl/dsl.rb
vedeu-0.6.2 lib/vedeu/dsl/dsl.rb
vedeu-0.6.1 lib/vedeu/dsl/dsl.rb
vedeu-0.6.0 lib/vedeu/dsl/dsl.rb
vedeu-0.5.13 lib/vedeu/dsl.rb
vedeu-0.5.12 lib/vedeu/dsl.rb
vedeu-0.5.11 lib/vedeu/dsl.rb
vedeu-0.5.10 lib/vedeu/dsl.rb
vedeu-0.5.9 lib/vedeu/dsl.rb
vedeu-0.5.8 lib/vedeu/dsl.rb
vedeu-0.5.7 lib/vedeu/dsl.rb
vedeu-0.5.6 lib/vedeu/dsl.rb