def find_method(name, constant=nil)
methods = []
methods = Entry.find_all_by_name(name.to_s)
methods = Entry.all(:conditions => ["name LIKE ?", name.to_s + "%"]) if methods.empty?
methods = Entry.find_by_sql("select * from entries where name LIKE '#{name.to_s.gsub("*", "%")}'") if methods.empty?
methods = Entry.find_by_sql("select * from entries where name LIKE '%#{name.to_s.split("").join("%")}%'") if methods.empty?
methods = methods.sort_by(&:weighting)
if constant
constants = find_constant(constant)
methods = methods.select { |m| constants.include?(m.constant) }
end
methods
end