aboutsummaryrefslogtreecommitdiffstats
path: root/lib/arel/nodes/function.rb
diff options
context:
space:
mode:
authorMaxime Lapointe <hunter_spawn@hotmail.com>2017-07-25 09:12:11 -0400
committerMaxime Lapointe <hunter_spawn@hotmail.com>2017-07-25 09:50:27 -0400
commit6d225a9870aea1fa25ab71774206d08d5b216355 (patch)
tree40783c0a30112b4c75ae903672e8763c4930fae7 /lib/arel/nodes/function.rb
parent0e7ce3f4c7c17e72f905b26aff3893149f524888 (diff)
downloadrails-6d225a9870aea1fa25ab71774206d08d5b216355.tar.gz
rails-6d225a9870aea1fa25ab71774206d08d5b216355.tar.bz2
rails-6d225a9870aea1fa25ab71774206d08d5b216355.zip
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
Diffstat (limited to 'lib/arel/nodes/function.rb')
-rw-r--r--lib/arel/nodes/function.rb2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/arel/nodes/function.rb b/lib/arel/nodes/function.rb
index 28a394e9f3..b2b89ee9ff 100644
--- a/lib/arel/nodes/function.rb
+++ b/lib/arel/nodes/function.rb
@@ -29,6 +29,8 @@ module Arel
self.alias == other.alias &&
self.distinct == other.distinct
end
+ alias :== :eql?
+
end
%w{