Sha256: f1d83359ae3da07e36fb6712794d5e5d514d7d636724e1b34c8d52e13ec295c5

Contents?: true

Size: 529 Bytes

Versions: 11

Compression:

Stored size: 529 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

      environment.add_datastreams(csv.first.collect { |datastream_value| DataStream.new(:value => datastream_value) })

      environment
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
eeml-0.0.42 lib/eeml/csv_parser_v1.rb
eeml-0.0.41 lib/eeml/csv_parser_v1.rb
eeml-0.0.40 lib/eeml/csv_parser_v1.rb
eeml-0.0.39 lib/eeml/csv_parser_v1.rb
eeml-0.0.38 lib/eeml/csv_parser_v1.rb
eeml-0.0.37 lib/eeml/csv_parser_v1.rb
eeml-0.0.36 lib/eeml/csv_parser_v1.rb
eeml-0.0.35 lib/eeml/csv_parser_v1.rb
eeml-0.0.34 lib/eeml/csv_parser_v1.rb
eeml-0.0.33 lib/eeml/csv_parser_v1.rb
eeml-0.0.32 lib/eeml/csv_parser_v1.rb