lib/lookup.rb in lookup-0.2.2 vs lib/lookup.rb in lookup-0.3.0

- old
+ new

@@ -79,22 +79,25 @@ end /#{parts.join("::")}/i end def smart_rails_constant_substitutions(name) - parts=name.split("::").map { |x| x.split(":")}.flatten - rep = case parts.first.downcase - # so it falls back on fuzzy and matches AR as well as ActiveResource - when "ar" then "ActiveRecord" - when "ares" then "ActiveResource" - when "am" then "ActionMailer" - when "as" then "ActiveSupport" - when "ac" then "ActionController" - when "av" then "ActionView" - else - parts.first + parts = name.split("::").map { |x| x.split(":")}.flatten + if parts.first + rep = case parts.first.downcase + # so it falls back on fuzzy and matches AR as well as ActiveResource + when "ar" then "ActiveRecord" + when "ares" then "ActiveResource" + when "am" then "ActionMailer" + when "as" then "ActiveSupport" + when "ac" then "ActionController" + when "av" then "ActionView" + else + parts.first + end + return ([rep] + parts[1..-1]).join("::") end - ([rep] + parts[1..-1]).join("::") + name end # Find an entry. # If the constant argument is passed, look it up within the scope of the constant. def find_method(name, constant=nil)