Class: DataMapper::Query::Conditions::Operation
- Inherits:
-
Object
- Object
- DataMapper::Query::Conditions::Operation
- Defined in:
- lib/dm-core/query/conditions/operation.rb
Class Method Summary collapse
-
.new(slug, *operands) ⇒ AbstractOperation
Factory method to initialize an operation.
-
.slugs ⇒ Array
private
Return an Array of all the slugs for the operation classes.
Class Method Details
.new(slug, *operands) ⇒ AbstractOperation
Factory method to initialize an operation
19 20 21 22 23 24 25 |
# File 'lib/dm-core/query/conditions/operation.rb', line 19 def self.new(slug, *operands) if klass = operation_class(slug) klass.new(*operands) else raise ArgumentError, "No Operation class for #{slug.inspect} has been defined" end end |
.slugs ⇒ Array
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Return an Array of all the slugs for the operation classes
33 34 35 |
# File 'lib/dm-core/query/conditions/operation.rb', line 33 def self.slugs AbstractOperation.descendants.map { |operation_class| operation_class.slug } end |