diff options
Diffstat (limited to 'lib/active_relation')
-rw-r--r-- | lib/active_relation/predicates.rb | 6 | ||||
-rw-r--r-- | lib/active_relation/relations/attribute.rb | 14 | ||||
-rw-r--r-- | lib/active_relation/relations/order.rb | 2 | ||||
-rw-r--r-- | lib/active_relation/relations/projection.rb | 2 | ||||
-rw-r--r-- | lib/active_relation/relations/rename.rb | 6 |
5 files changed, 15 insertions, 15 deletions
diff --git a/lib/active_relation/predicates.rb b/lib/active_relation/predicates.rb index 5ac879899b..6616cfd414 100644 --- a/lib/active_relation/predicates.rb +++ b/lib/active_relation/predicates.rb @@ -14,7 +14,7 @@ module ActiveRelation end def ==(other) - super and @attribute1.eql?(other.attribute1) and @attribute2.eql?(other.attribute2) + super and @attribute1 == other.attribute1 and @attribute2 == other.attribute2 end def qualify @@ -29,8 +29,8 @@ module ActiveRelation class Equality < Binary def ==(other) self.class == other.class and - ((attribute1.eql?(other.attribute1) and attribute2.eql?(other.attribute2)) or - (attribute1.eql?(other.attribute2) and attribute2.eql?(other.attribute1))) + ((attribute1 == other.attribute1 and attribute2 == other.attribute2) or + (attribute1 == other.attribute2 and attribute2 == other.attribute1)) end protected diff --git a/lib/active_relation/relations/attribute.rb b/lib/active_relation/relations/attribute.rb index b7233a4b17..2fe702cb14 100644 --- a/lib/active_relation/relations/attribute.rb +++ b/lib/active_relation/relations/attribute.rb @@ -21,32 +21,32 @@ module ActiveRelation self.alias(qualified_name) end - def eql?(other) + def ==(other) relation == other.relation and name == other.name and @alias == other.alias end module Predications - def ==(other) + def equals(other) Predicates::Equality.new(self, other) end - def <(other) + def less_than(other) Predicates::LessThan.new(self, other) end - def <=(other) + def less_than_or_equal_to(other) Predicates::LessThanOrEqualTo.new(self, other) end - def >(other) + def greater_than(other) Predicates::GreaterThan.new(self, other) end - def >=(other) + def greater_than_or_equal_to(other) Predicates::GreaterThanOrEqualTo.new(self, other) end - def =~(regexp) + def matches(regexp) Predicates::Match.new(self, regexp) end end diff --git a/lib/active_relation/relations/order.rb b/lib/active_relation/relations/order.rb index 99ff939528..c8034d2f17 100644 --- a/lib/active_relation/relations/order.rb +++ b/lib/active_relation/relations/order.rb @@ -8,7 +8,7 @@ module ActiveRelation end def ==(other) - relation == other.relation and orders.eql?(other.orders) + relation == other.relation and orders == other.orders end def qualify diff --git a/lib/active_relation/relations/projection.rb b/lib/active_relation/relations/projection.rb index b30c76898d..df25d16234 100644 --- a/lib/active_relation/relations/projection.rb +++ b/lib/active_relation/relations/projection.rb @@ -8,7 +8,7 @@ module ActiveRelation end def ==(other) - relation == other.relation and attributes.eql?(other.attributes) + relation == other.relation and attributes == other.attributes end def qualify diff --git a/lib/active_relation/relations/rename.rb b/lib/active_relation/relations/rename.rb index 7a1693df57..8f28c94d52 100644 --- a/lib/active_relation/relations/rename.rb +++ b/lib/active_relation/relations/rename.rb @@ -9,7 +9,7 @@ module ActiveRelation end def ==(other) - relation == other.relation and schmattribute.eql?(other.schmattribute) and self.alias == other.alias + relation == other.relation and schmattribute == other.schmattribute and self.alias == other.alias end def attributes @@ -24,14 +24,14 @@ module ActiveRelation def attribute(name) case when name == self.alias then schmattribute.alias(self.alias) - when relation[name].eql?(schmattribute) then nil + when relation[name] == schmattribute then nil else relation[name] end end private def substitute(a) - a.eql?(schmattribute) ? a.alias(self.alias) : a + a == schmattribute ? a.alias(self.alias) : a end end end |