mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
6d225a9870
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
15 lines
248 B
Ruby
15 lines
248 B
Ruby
# frozen_string_literal: true
|
|
module Arel
|
|
module Nodes
|
|
class False < Arel::Nodes::Node
|
|
def hash
|
|
self.class.hash
|
|
end
|
|
|
|
def eql? other
|
|
self.class == other.class
|
|
end
|
|
alias :== :eql?
|
|
end
|
|
end
|
|
end
|