require 'coderay' # scan this file tokens = CodeRay.scan(File.read($0) * 1, :ruby) # output it with two styles of line numbers out = tokens.div(:line_numbers => :table) out << '