Class: DataMapper::Query::Conditions::Comparison
- Inherits:
-
Object
- Object
- DataMapper::Query::Conditions::Comparison
- Defined in:
- lib/dm-core/query/conditions/comparison.rb
Overview
An abstract class which provides easy access to comparison operators
Class Method Summary collapse
-
.new(slug, subject, value) ⇒ DataMapper::Query::Conditions::AbstractComparison
Creates a new Comparison instance.
-
.slugs ⇒ Array<Symbol>
private
Returns an array of all slugs registered with Comparison.
Class Method Details
.new(slug, subject, value) ⇒ DataMapper::Query::Conditions::AbstractComparison
Creates a new Comparison instance
The returned instance will be suitable for matching the given subject (property or relationship) against the value.
56 57 58 59 60 |
# File 'lib/dm-core/query/conditions/comparison.rb', line 56 def self.new(slug, subject, value) raise ArgumentError, "No Comparison class for #{slug.inspect} has been defined" unless (klass = comparison_class(slug)) klass.new(subject, value) end |
.slugs ⇒ Array<Symbol>
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.
Returns an array of all slugs registered with Comparison
67 68 69 |
# File 'lib/dm-core/query/conditions/comparison.rb', line 67 def self.slugs AbstractComparison.descendants.map(&:slug) end |