class WebTools::MethodList

Public Class Methods

description() click to toggle source
Calls superclass method
# File lib/web_tools/method_list.rb, line 8
def self.description
  super
end

Public Instance Methods

execute(meth) click to toggle source
# File lib/web_tools/method_list.rb, line 16
def execute(meth)
  callables = { "method" => method(:find_method),
    "implementors" => method(:implementors),
    "senders" => method(:senders),
    "referencesToGlobal" => method(:references_to_global) }
  callable = callables[meth]
  return {"a" => "AAA"} if callable.nil?
  callable[]
end
find_method() click to toggle source
# File lib/web_tools/method_list.rb, line 26
def find_method
  name = non_meta_name(params["klass"])
  is_meta = !(name == params["klass"])
  klass = reflect(Object).constant(name).value
  klass = klass.singleton_class if is_meta
  meth = klass.method(params["selector"])
  { "dictionaryName" => params["dict"],
    "className" => klass.name,
    "isMeta" => is_meta,
    "source" => meth.source,
    "stepPoints" => meth.step_offsets,
    "sends" => meth.send_offsets }
end
implementors() click to toggle source
# File lib/web_tools/method_list.rb, line 40
def implementors
  return {} unless params["find"]
  methods(system.implementations_of(params["find"]))
end
methods(list) click to toggle source
# File lib/web_tools/method_list.rb, line 54
def methods(list)
  list = list.collect do |meth|
    klass = meth.defining_class
    nesting = klass.nesting
    dict = nesting[1] ? nesting[1].name : "" # [klass, parent, ...]
    { "dict" => dict,
      "klassCat" => "",
      "klass" => klass.name,
      "category" => "",
      "selector" => meth.selector }
  end
  { "list" => list }
end
references_to_global() click to toggle source
# File lib/web_tools/method_list.rb, line 50
def references_to_global
  return {} # Not supported on Ruby, too dynamic
end
senders() click to toggle source
# File lib/web_tools/method_list.rb, line 45
def senders
  return {} unless params["find"]
  methods(system.senders_of(params["find"]))
end