Sha256: f822a0384f0cb112cd08d3f0aa636b3be84e96ae7c78537759eef022b1e16fb2
Contents?: true
Size: 799 Bytes
Versions: 1
Compression:
Stored size: 799 Bytes
Contents
class CsvEncodingError < StandardError ; end module Eeml class CsvParserV2 def self.make_environment_from_csv(csv_content) csv = LightCsv.parse(strip_content(csv_content)) environment = Environment.new(:csv_version => 'v2') environment.private = nil csv = strip_content(csv) datastreams = csv.collect do |datastream| raise(CsvEncodingError, "CSV is invalid. Double check you are properly encoding line breaks.") if datastream.length == 3 && datastream[1].include?('\n') raise(CsvEncodingError, "CSV is invalid. Incorrect number of fields.") if datastream.length != 2 DataStream.new(:value => datastream.last, :identifier => datastream.first) end environment.add_datastreams(datastreams) environment end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
eeml-0.0.42 | lib/eeml/csv_parser_v2.rb |