12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# File 'lib/pebbles/php_cond.rb', line 12
def self.equal?(rhs, lhs)
return true if rhs.equal?(lhs)
return bool(lhs) if rhs.equal?(true)
return bool(rhs) if lhs.equal?(true)
return !bool(lhs) if rhs.equal?(false)
return !bool(rhs) if lhs.equal?(false)
return equal_as_numeric(rhs, lhs) if rhs.is_a?(Numeric)
return equal_as_numeric(lhs, rhs) if lhs.is_a?(Numeric)
return !(lhs === '0' || bool(lhs)) if rhs.nil?
return !(rhs === '0' || bool(rhs)) if lhs.nil?
return rhs.eql?(lhs) if rhs.class == lhs.class
return false if rhs.is_a?(String) || lhs.is_a?(String)
return true if rhs.is_a?(Enumerable) && lhs.is_a?(Enumerable) && rhs.count.eql?(0) && lhs.count.eql?(0)
return false
end
|