class Noraneko::NMethod

Attributes

called_methods[RW]
line[R]
name[R]
scope[W]
type[W]

Public Class Methods

class_method(nconst, name, line) click to toggle source
# File lib/noraneko/nmethod.rb, line 22
def self.class_method(nconst, name, line)
  new(nconst, name, line, :public, :class)
end
instance_method(nconst, name, line, scope = :public) click to toggle source
# File lib/noraneko/nmethod.rb, line 18
def self.instance_method(nconst, name, line, scope = :public)
  new(nconst, name, line, scope, :instance)
end
new(nconst, name, line, scope, type) click to toggle source
# File lib/noraneko/nmethod.rb, line 9
def initialize(nconst, name, line, scope, type)
  @nconst = nconst
  @name = name
  @line = line
  @called_methods = []
  @scope = scope
  @type = type
end

Public Instance Methods

called?(other_name) click to toggle source
# File lib/noraneko/nmethod.rb, line 34
def called?(other_name)
  @called_methods.include?(other_name)
end
class_method!() click to toggle source
# File lib/noraneko/nmethod.rb, line 55
def class_method!
  @type = :class
end
class_method?() click to toggle source
# File lib/noraneko/nmethod.rb, line 59
def class_method?
  @type == :class
end
in?(nconst) click to toggle source
# File lib/noraneko/nmethod.rb, line 30
def in?(nconst)
  nconst.qualified_name == @nconst.qualified_name
end
in_private?() click to toggle source
# File lib/noraneko/nmethod.rb, line 51
def in_private?
  !in_public?
end
in_public?() click to toggle source
# File lib/noraneko/nmethod.rb, line 47
def in_public?
  @scope == :public
end
instance_method?() click to toggle source
# File lib/noraneko/nmethod.rb, line 63
def instance_method?
  !class_method?
end
loc() click to toggle source
# File lib/noraneko/nmethod.rb, line 26
def loc
  "#{@nconst.path}:#{@line}"
end
private!() click to toggle source
# File lib/noraneko/nmethod.rb, line 43
def private!
  @scope = :private
end
qualified_name() click to toggle source
# File lib/noraneko/nmethod.rb, line 38
def qualified_name
  delimiter = class_method? ? '.' : '#'
  "#{@nconst.qualified_name}#{delimiter}#{@name}"
end