Class: RKelly::Nodes::ResolveNode

Inherits:
Node
  • Object
show all
Defined in:
lib/rkelly/nodes/resolve_node.rb

Instance Attribute Summary

Attributes inherited from Node

#comments, #filename, #range, #value

Instance Method Summary collapse

Methods inherited from Node

#===, #each, #initialize, #line, #pointcut, #to_dots, #to_ecma, #to_real_sexp, #to_sexp

Methods included from Visitable

#accept, included

Constructor Details

This class inherits a constructor from RKelly::Nodes::Node

Instance Method Details

#==(other) ⇒ Object Also known as: =~



4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/rkelly/nodes/resolve_node.rb', line 4

def ==(other)
  return true if super
  if ('A'..'Z').include? @value[0]
    place = [Object, Module, RKelly::Nodes].find { |x|
      x.const_defined?(@value.to_sym)
    }
    return false unless place
    klass = place.const_get(@value.to_sym)
    return true if klass && other.is_a?(klass) || other.value.is_a?(klass)
  end
  false
end