Sha256: 037c027d61d2bc7b08209c52f7e71d18bf881da4d4a353a58159c43701f51776
Contents?: true
Size: 662 Bytes
Versions: 4
Compression:
Stored size: 662 Bytes
Contents
class CsvEncodingError < StandardError ; end module Eeml class CsvParserV2 def self.make_environment_from_csv(csv_content) csv = LightCsv.parse(csv_content) environment = Environment.new csv.each 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 environment.datastreams << DataStream.new(:value => datastream.last, :identifier => datastream.first) end environment end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
eeml-0.0.25 | lib/eeml/csv_parser_v2.rb |
eeml-0.0.24 | lib/eeml/csv_parser_v2.rb |
eeml-0.0.23 | lib/eeml/csv_parser_v2.rb |
eeml-0.0.22 | lib/eeml/csv_parser_v2.rb |