Skip to content

Instantly share code, notes, and snippets.

# c = CSVBuilder.new ['column 1 name', 'column 2 name', 'column 3 name']
# rowdata.each do |r|
# special_column = r.boolean ? 'YES' : 'NO'
# c.add_row [special_column, r.name, r.date]
# end
# c.export('optional_filename.csv')
class CSVBuilder
def initialize(head)
if head.is_a?(Array)
class Uri < ActiveRecord::Base
belongs_to :job
has_many :scrapes
def get_request_object options
require 'rubygems'
require 'typhoeus'
request = Typhoeus::Request.new(self.uri, options)