def search(msg, options={})
options[:api] ||= if /^1\.9/.match(msg)
"Ruby 1.9"
elsif /^1\.8/.match(msg)
"Ruby 1.8.7"
elsif /^Rails/i.match(msg)
"Rails"
end
msg = msg.gsub(/^(.*?)\s/, "") if options[:api]
splitter = options[:splitter] || "#"
parts = msg.split(" ")[0..-1].flatten.map { |a| a.split(splitter) }.flatten!
first = smart_rails_constant_substitutions(parts.first)
output = if /^[A-Z]/.match(first) && parts.size == 1
find_constant(first)
else
if parts.size == 1
o = find_method(parts.last)
else
o = find_method(parts.last, first)
end
o
end
output = search(msg, options.merge(:splitter => ".")) if output.empty? && splitter != "."
options[:api] ||= ["Ruby 1.8.7", "Rails"]
selected_output = output.select { |m| options[:api].include?(m.api.name) }
selected_output = output if selected_output.empty?
return selected_output
end