Top Level Namespace
Defined Under Namespace
Modules: CSVHash
Constant Summary collapse
- CSV =
FasterCSV
Instance Method Summary collapse
-
#CSVHash(arg, columns = nil) ⇒ Object
Pass either a path to a csv file to parse which will return an array of hashes (stringified keys) or pass an array of hashes and an array of column names See readme.rdoc for more detaild information.
Instance Method Details
#CSVHash(arg, columns = nil) ⇒ Object
Pass either a path to a csv file to parse which will return an array of hashes (stringified keys) or pass an array of hashes and an array of column names See readme.rdoc for more detaild information
77 78 79 80 81 82 83 84 85 |
# File 'lib/csv-hash.rb', line 77 def CSVHash arg, columns=nil if arg.is_a?(File) CSVHash.from_file(arg.path) elsif arg.is_a?(String) CSVHash.from_file(arg) elsif arg.is_a?(Array) && columns.is_a?(Array) CSVHash.to_string(arg,columns) end end |