Permalink
Browse files

Update rubyforge example to avoid unnecessary block form of mechanize…

… initialization
  • Loading branch information...
1 parent 3ef2c40 commit fe63a56225487b93749b16ea3b8896cc9f19d271 @drbrain drbrain committed May 15, 2012
Showing with 5 additions and 3 deletions.
  1. +5 −3 examples/rubyforge.rb
View
8 examples/rubyforge.rb
@@ -5,11 +5,13 @@
require 'logger'
# Create a new mechanize object
-agent = Mechanize.new { |a| a.log = Logger.new(STDERR) }
+mech = Mechanize.new
+mech.log = Logger.new $stderr
+mech.agent.http.debug_output = $stderr
# Load the rubyforge website
-page = agent.get('http://rubyforge.org/')
-page = agent.click page.link_with(:text => /Log In/) # Click the login link
+page = mech.get('http://rubyforge.org/')
+page = mech.click page.link_with(:text => /Log In/) # Click the login link
form = page.forms[1] # Select the first form
form.form_loginname = ARGV[0]
form.form_pw = ARGV[1]

0 comments on commit fe63a56

Please sign in to comment.