Files
codeql/ruby/ql/test/library-tests/modules/callgraph.ql
Harry Maclean 8df5aaa797 Ruby: Model private class methods
`Module#private_class_method` takes a symbol representing the name of a
method in the current module scope and makes that module private. This
is similar to `private`, but applies only to class (singleton) methods.
Unlike `private`, it must be called with an argument, and does not
change the ambient visibility for any subsequent method definitions.

    class Foo
      def public
      end

      def private1
      end
      private_class_method :private1

      # This alternate form works because method definition
      # returns its name as a symbol:

      private_class_method def private2
      end
    end
2021-12-09 18:15:25 +13:00

8 lines
220 B
Plaintext

import ruby
query Callable getTarget(Call call) { result = call.getATarget() }
query predicate unresolvedCall(Call call) { not exists(call.getATarget()) }
query predicate privateMethod(MethodBase m) { m.isPrivate() }