Module: CodeModels::ComparisonModule

Included in:
CodeModelsAstNode
Defined in:
lib/codemodels/comparison.rb

Instance Method Summary collapse

Instance Method Details

#==(other) ⇒ Object



18
19
20
# File 'lib/codemodels/comparison.rb', line 18

def ==(other)
  eql? other
end

#eql?(other) ⇒ Boolean

Returns:

  • (Boolean)


6
7
8
9
10
11
12
13
14
15
16
# File 'lib/codemodels/comparison.rb', line 6

def eql?(other)
  return false unless RGen::Ext::Comparison::DeepComparator.eql?(self,other)
  if self.respond_to?(:source) || other.respond_to?(:source)
    return false if (self.source==nil) != (other.source==nil)
    return true if self.source==nil
    return false if (self.source.position==nil) != (other.source.position==nil)       
    return true if self.source.position==nil
    return self.source.position(:absolute)==other.source.position(:absolute)
  end
  true
end