CodeQL library for Ruby
codeql/ruby-all 0.8.15-dev (changelog, source)
Search

Predicate DataFlow::getConstant

Gets a constant reference that may resolve to the top-level constant name.

To get nested constants, call getConstant() one or more times on the result.

For example DataFlow::getConstant("A").getConstant("B") finds the following:

A::B # simple reference

module A
  B # in scope
  module X
    B # in nested scope
  end
end

module X
  include A
  B # via inclusion
end

class X < A
  B # via subclassing
end

Import path

import ruby
ConstRef getConstant(string name)