3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
# File 'lib/dm-core/support/equalizer.rb', line 3
def equalize(*methods)
class_eval " def eql?(other)\n return true if equal?(other)\n instance_of?(other.class) &&\n \#{methods.map { |method| \"\#{method}.eql?(other.\#{method})\" }.join(' && ')}\n end\n\n def ==(other)\n return true if equal?(other)\n \#{methods.map { |method| \"other.respond_to?(\#{method.inspect})\" }.join(' && ')} &&\n \#{methods.map { |method| \"\#{method} == other.\#{method}\" }.join(' && ')}\n end\n\n def hash\n [ \#{methods.join(', ')} ].hash\n end\n RUBY\nend\n", __FILE__, __LINE__ + 1
|