Class Index [+]

Quicksearch

DataMapper::Query::Conditions::Operation

Public Class Methods

new(slug, *operands) click to toggle source

Factory method to initialize an operation

@example

  operation = Operation.new(:and, comparison)

@param [Symbol] slug

  the identifier for the operation class

@param [Array] *operands

  the operands to initialize the operation with

@return [AbstractOperation]

  the operation matching the slug

@api semipublic

    # File lib/dm-core/query/conditions/operation.rb, line 19
19:         def self.new(slug, *operands)
20:           if klass = operation_class(slug)
21:             klass.new(*operands)
22:           else
23:             raise ArgumentError, "No Operation class for #{slug.inspect} has been defined"
24:           end
25:         end
slugs() click to toggle source

Return an Array of all the slugs for the operation classes

@return [Array]

  the slugs of all the operation classes

@api private

    # File lib/dm-core/query/conditions/operation.rb, line 33
33:         def self.slugs
34:           AbstractOperation.descendants.map { |operation_class| operation_class.slug }
35:         end

Private Class Methods

operation_class(slug) click to toggle source

Lookup the operation class based on the slug

@example

  operation_class = Operation.operation_class(:and)

@param [Symbol] slug

  the identifier for the operation class

@return [Class]

  the operation class

@api private

    # File lib/dm-core/query/conditions/operation.rb, line 62
62:           def operation_class(slug)
63:             operation_classes[slug] ||= AbstractOperation.descendants.detect { |operation_class| operation_class.slug == slug }
64:           end
operation_classes() click to toggle source

Returns a Hash mapping the slugs to each class

@return [Hash]

  Hash mapping the slug to the class

@api private

    # File lib/dm-core/query/conditions/operation.rb, line 46
46:           def operation_classes
47:             @operation_classes ||= {}
48:           end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.