Using each_line.with_index as per @rogeriozambon suggestion

Tried running:
require 'rubygems'
require './rfactor'
CODE=%Q{
  def the_method(firstArg, secondArg)
    puts :code
    puts /to be/
    puts 'refactored'
  end

  def more()
    n = 3+2/7
    puts "other \#{n}"
    n
  end
}
code = Rfactor::Code.new(CODE)
code.extract_method(:name => "common", :start => 3, :end => 5)

on both IRB1.8 and IRB1.9 and had to fix a few more each_line.with_index.