From 6d225a9870aea1fa25ab71774206d08d5b216355 Mon Sep 17 00:00:00 2001 From: Maxime Lapointe Date: Tue, 25 Jul 2017 09:12:11 -0400 Subject: Add missing hash, eql?, == to various node classes Some of the nodes classes are missing either one or many of the common comparison methods #hash, #eql? and #==. This makes comparision and working with the ast sometimes painful, as equality or operations likes array differences (which uses a hash behind the scene) produces unexpected results. A test has been added that ensures that every descendants of Node: * have all 3 methods * that all 3 methods were defined from the same class * that the class defining all 3 is also a descendant of Node, to avoid the default ones that rely on identity only --- lib/arel/nodes/true.rb | 1 + 1 file changed, 1 insertion(+) (limited to 'lib/arel/nodes/true.rb') diff --git a/lib/arel/nodes/true.rb b/lib/arel/nodes/true.rb index 796b5b9348..bb9d8c1414 100644 --- a/lib/arel/nodes/true.rb +++ b/lib/arel/nodes/true.rb @@ -9,6 +9,7 @@ module Arel def eql? other self.class == other.class end + alias :== :eql? end end end -- cgit v1.2.3