Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Update rubyforge example to avoid unnecessary block form of mechanize…

… initialization
  • Loading branch information...
commit fe63a56225487b93749b16ea3b8896cc9f19d271 1 parent 3ef2c40
@drbrain drbrain authored
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]
Please sign in to comment.
Something went wrong with that request. Please try again.