Created
October 5, 2011 01:04
-
-
Save dwillis/1263335 to your computer and use it in GitHub Desktop.
RemoteTable CSV 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
| ree-1.8.7-2011.03 :001 > require 'rubygems' | |
| => true | |
| ree-1.8.7-2011.03 :002 > require 'remote_table' | |
| [remote_table] Ruby 1.8 detected, setting $KCODE to UTF8 so that ActiveSupport::Multibyte works properly. | |
| => true | |
| ree-1.8.7-2011.03 :009 > table = RemoteTable.new "http://www.irs.gov/pub/irs-soi/stateoutflow0809.csv", :headers => true | |
| => #<RemoteTable:0x101c22750 @url="http://www.irs.gov/pub/irs-soi/stateoutflow0809.csv", @options={"headers"=>true}> | |
| ree-1.8.7-2011.03 :010 > entry = table.entries.first | |
| => #<OrderedHash {"County_Code_Dest"=>"000", "State_Code_Origin"=>"00", "Return_Num"=>"3134167", "State_Abbrv"=>"US", "County_Code_Origin"=>"000", "State_Name"=>"US Total Mig - US & For", "Exmpt_Num"=>"5834133", "Aggr_AGI"=>"150297046", "State_Code_Dest"=>"96"}> | |
| ree-1.8.7-2011.03 :011 > entry['Return_Num'].to_i | |
| => 3134167 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment