class DataMapper::Query::Conditions::EqualToComparison
Tests whether the value in the record is equal to the expected set for the Comparison.
Public Instance Methods
matches?(record)
click to toggle source
Tests that the record value matches the comparison
@param [Resource, Hash] record
The record containing the value to be matched
@return [Boolean]
@api semipublic
Calls superclass method
DataMapper::Query::Conditions::RelationshipHandler#matches?
# File lib/dm-core/query/conditions/comparison.rb, line 529 def matches?(record) if expected.nil? record_value(record).nil? else super end end
Private Instance Methods
comparator_string()
click to toggle source
@return [String]
@see DataMapper::Query::Conditions::AbstractComparison#to_s
@api private
# File lib/dm-core/query/conditions/comparison.rb, line 563 def comparator_string '=' end
typecast_hash(hash)
click to toggle source
@api private
# File lib/dm-core/query/conditions/comparison.rb, line 548 def typecast_hash(hash) subject = self.subject subject.target_model.new(subject.query.merge(hash)) end
typecast_relationship(value)
click to toggle source
@api private
# File lib/dm-core/query/conditions/comparison.rb, line 540 def typecast_relationship(value) case value when Hash then typecast_hash(value) when Resource then typecast_resource(value) end end
typecast_resource(resource)
click to toggle source
@api private
# File lib/dm-core/query/conditions/comparison.rb, line 554 def typecast_resource(resource) resource end