class FastRI::RiService::MatchFinder
Public Class Methods
new() { |ret| ... }
click to toggle source
Calls superclass method
# File lib/fastri/ri_service.rb, line 74 def self.new ret = super yield ret if block_given? ret end
new()
click to toggle source
# File lib/fastri/ri_service.rb, line 80 def initialize @matchers = {} end
Public Instance Methods
add_matcher(name, &block)
click to toggle source
# File lib/fastri/ri_service.rb, line 84 def add_matcher(name, &block) @matchers[name] = block end
get_matches(methods)
click to toggle source
# File lib/fastri/ri_service.rb, line 88 def get_matches(methods) catch(:MatchFinder_return) do methods.each do |name| matcher = @matchers[name] matcher.call(self) if matcher end [] end end
yield(matches)
click to toggle source
# File lib/fastri/ri_service.rb, line 98 def yield(matches) case matches when nil, []; nil when Array throw :MatchFinder_return, matches else throw :MatchFinder_return, [matches] end end