0.0
No commit activity in last 3 years
No release in over 3 years
RapidTransit allows you to create text file parsers for use in a Ruby on Rails application.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

>= 2.3.8
 Project Readme

Rapid Transit

This repository is in alpha

Create a text file importer with rapid_transit as follows:

class WombatImporter < RapidTransit::Base

  # Set the columns in your text file
  columns :wombat_name, :favorite_food, :color, :furriness

  # Find or initialize a Wombat by name
  find_or_initialize :wombat, :name => :wombat_name

  # Find a food record that matches
  find :food, :name => :favorite_food

  # Update the wombat's attributes
  update_attributes :wombat, :color => :color, :furriness => :furriness

  # Set associations
  exec do |row|
    row[:wombat].foods << row[:food]
  end

end

The commands listed in the WombatImporter will be executed for each line in the text file. After building your importer, you can parse your text file by calling:

WombatImporter.parse File.open('/path/to/file')