Skip to content

Commit

Permalink
adding deprecation notice
Browse files Browse the repository at this point in the history
  • Loading branch information
tenderlove committed Feb 7, 2010
1 parent ca41f8d commit 3587836
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions lib/mechanize.rb
Expand Up @@ -37,7 +37,7 @@
# require 'mechanize'
# require 'logger'
#
# agent = WWW::Mechanize.new { |a| a.log = Logger.new("mech.log") }
# agent = Mechanize.new { |a| a.log = Logger.new("mech.log") }
# agent.user_agent_alias = 'Mac Safari'
# page = agent.get("http://www.google.com/")
# search_form = page.form_with(:name => "f")
Expand Down Expand Up @@ -637,6 +637,20 @@ def add_to_history(page)
end
end

module WWW; end
WWW::Mechanize = ::Mechanize
module WWW
def self.const_missing klass
warn <<eomsg
!!!!! DEPRECATION NOTICE !!!!!
The WWW constant is deprecated, please switch to the new top-level Mechanize
constant. WWW will be removed in Mechanize version 2.0
You've referenced the WWW constant from #{caller.first}, please
switch the "WWW" to "Mechanize". Thanks!
Sincerely,
Pew Pew Pew
eomsg
Object.const_get(klass)
end
end

0 comments on commit 3587836

Please sign in to comment.