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, #line, #value

Instance Method Summary collapse

Methods inherited from Node

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

Methods included from Visitable

#accept

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 @value =~ /^[A-Z]/
    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