Module: RubyBreaker::Runtime::Inspector

Defined in:
lib/rubybreaker/runtime/inspector.rb

Overview

This module inspects type information gathered so far.

Class Method Summary collapse

Class Method Details

.inspect_all(mod) ⇒ Object

This method inspects the module for all methods. It returns a Hash containing (method name, method type) pairs.



41
42
43
44
45
46
# File 'lib/rubybreaker/runtime/inspector.rb', line 41

def self.inspect_all(mod)
  mtypes = {}
  mm = TYPE_MAP[mod]
  mm.each_pair {|im,mtype| mtypes[im] = mtype if mtype } if mm
  return mtypes
end

.inspect_class_meth(mod, mname) ⇒ Object

This method inspects the module for the specified class method name. This is a shorthand for calling inspect_meth with the eigen class.



25
26
27
28
# File 'lib/rubybreaker/runtime/inspector.rb', line 25

def self.inspect_class_meth(mod, mname)
  eigen_class = Runtime.eigen_class(mod)
  return self.inspect_meth(eigen_class, mname)
end

.inspect_meth(mod, mname) ⇒ Object

This method inspects the module for the type of the specified method.



17
18
19
20
21
# File 'lib/rubybreaker/runtime/inspector.rb', line 17

def self.inspect_meth(mod, mname)
  mname = mname.to_sym 
  t = TYPE_MAP[mod][mname] if TYPE_MAP.has_key?(mod)
  return t
end

.inspect_meths(mod, mnames) ⇒ Object

Similar to inspect_meth but returns a hash of (mname, mtype) pairs.



31
32
33
34
35
36
37
# File 'lib/rubybreaker/runtime/inspector.rb', line 31

def self.inspect_meths(mod, mnames)
  mtype_hash = {}
  mnames.each {|mname|
    mtype_hash[mname] = self.inspect_meth(mod, mname)
  }
  return mtype_hash
end