Adding to the existing answers:
You don't need to require
rubygemsas you are not using it at all. It is usually unnecessary. See here https://stackoverflow.com/questions/2711779/require-rubygems .When you have many requires you can do this trick to group them into one line:
require 'rubygems' require 'mechanize' require 'json' require 'net/http'Into
%w{rubygems mechanize json net/http}.each{|gem| require gem}