Hello, first thanks for trying to build a ruby version for supporting HXL. I'm the author of the (new) csvreader library / gem and I added a new library / gem, that is, csvhuman, see https://github.com/csvreader/csvhuman, that lets you read tabular data in the CSV Humanitarian eXchange Language (HXL) format in ruby. Example:
pp CsvHuman.parse( <<TXT ) ## or use HXL.parse
What,,,Who,Where,For whom,
Record,Sector/Cluster,Subsector,Organisation,Country,Males,Females,Subregion
,#sector+en,#subsector,#org,#country,#sex+#targeted,#sex+#targeted,#adm1
001,WASH,Subsector 1,Org 1,Country 1,100,100,Region 1
002,Health,Subsector 2,Org 2,Country 2,,,Region 2
003,Education,Subsector 3,Org 3,Country 2,250,300,Region 3
004,WASH,Subsector 4,Org 1,Country 3,80,95,Region 4
TXT
More ways to use the reader:
csv = CsvHuman.new( recs )
csv.each do |rec|
pp rec
end
pp csv.read
CsvHuman.parse( recs ).each do |rec|
pp rec
end
pp CsvHuman.read( "./test.csv" )
CsvHuman.foreach( "./test.csv" ) do |rec|
pp rec
end
#...
or use the HXL alias:
hxl = HXL.new( recs )
hxl.each do |rec|
pp rec
end
pp hxl.read
HXL.parse( recs ).each do |rec|
pp rec
end
pp HXL.read( "./test.csv" )
HXL.foreach( "./test.csv" ) do |rec|
pp rec
end
#...
Cheers. Prost.
Hello, first thanks for trying to build a ruby version for supporting HXL. I'm the author of the (new) csvreader library / gem and I added a new library / gem, that is, csvhuman, see https://github.com/csvreader/csvhuman, that lets you read tabular data in the CSV Humanitarian eXchange Language (HXL) format in ruby. Example:
More ways to use the reader:
or use the
HXLalias:Cheers. Prost.