Created
October 5, 2011 01:08
-
-
Save dwillis/1263343 to your computer and use it in GitHub Desktop.
RemoteTable Fixed-Width Example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
table = RemoteTable.new "ftp://ftp.fec.gov/FEC/webl12.zip", :filename => 'FECWEB/webl12.dat', | |
:format => :fixed_width, :cut => '-52,183-', | |
:schema => [ | |
['candid', 9, { :type => :string }], | |
['name', 38, { :type => :string }], | |
['ico', 1, { :type => :string }], | |
['party1', 1, { :type => :string }], | |
['party3', 3, { :type => :string }], | |
['state', 2, { :type => :string }], | |
['district', 2, { :type => :string }], | |
['special_status', 1, { :type => :string }], | |
['primary_status', 1, { :type => :string }], | |
['runoff_status', 1, { :type => :string }], | |
['general_status', 1, { :type => :string }], | |
['general_pct', 3, { :type => :string }] | |
] | |
=> #<RemoteTable:0x101a19c10 @url="ftp://ftp.fec.gov/FEC/webl12.zip", @options={"format"=>:fixed_width, "cut"=>"-52,183-", "schema"=>[["candid", 9, {:type=>:string}], ["name", 38, {:type=>:string}], ["ico", 1, {:type=>:string}], ["party1", 1, {:type=>:string}], ["party3", 3, {:type=>:string}], ["state", 2, {:type=>:string}], ["district", 2, {:type=>:string}], ["special_status", 1, {:type=>:string}], ["primary_status", 1, {:type=>:string}], ["runoff_status", 1, {:type=>:string}], ["general_status", 1, {:type=>:string}], ["general_pct", 3, {:type=>:string}]], "filename"=>"FECWEB/webl12.dat"}> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment