Sha256: 54acddff0398e124d30741825013a2424259f2177eabdf007d6ee3d5fdeea27c

Contents?: true

Size: 540 Bytes

Versions: 1

Compression:

Stored size: 540 Bytes

Contents

module Eeml
  class CsvParserV1

    def self.make_environment_from_csv(csv_content)
      csv = LightCsv.parse(strip_content(csv_content))
      environment = Environment.new(:csv_version => 'v1')

      raise(CsvEncodingError, "Currently Pachube can only accept csv for your most recent set of values. You have submitted #{csv.size} rows of data.") unless csv.size == 1

      csv.first.each do |datastream_value|
        environment.datastreams << DataStream.new(:value => datastream_value)
      end
      environment
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
eeml-0.0.29 lib/eeml/csv_parser_v1.rb