Class: ReFe::MethodSearcher
- Inherits:
-
Object
- Object
- ReFe::MethodSearcher
- Includes:
- Encoding, TraceUtils
- Defined in:
- lib/refe/searcher.rb
Instance Method Summary collapse
-
#initialize(ctable, mtable, igraph, policy) ⇒ MethodSearcher
constructor
A new instance of MethodSearcher.
- #search(keys) ⇒ Object
Methods included from TraceUtils
Methods included from Encoding
#adjust_encoding, #shift_jis_platform?
Constructor Details
#initialize(ctable, mtable, igraph, policy) ⇒ MethodSearcher
38 39 40 41 42 43 |
# File 'lib/refe/searcher.rb', line 38 def initialize( ctable, mtable, igraph, policy ) @class_table = ctable @method_table = mtable @inheritance_graph = igraph @policy = policy end |
Instance Method Details
#search(keys) ⇒ Object
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/refe/searcher.rb', line 45 def search( keys ) case keys.size when 0 @policy.print_names @class_table.classes when 1 key, = keys if /[\.\#\,]/ === key c, t, m = key.split(/([\.\#\,])/, 2) t = '#' if t == ',' c = nil if c.empty? m = nil if m.empty? try c, t, m elsif /\A[A-Z]/ === key try key, nil, nil else begin try nil, nil, key rescue CompletionError try key, nil, nil end end when 2 c, m = keys c, t, = c.split(/([\.\#\,])/, 2) t = '#' if t == ',' try c, t, m when 3 try(*keys) else raise '[ReFe BUG] argv > 3' end end |