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
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
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
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.