Sha256: f501f60f0ab4eb201b0dc4cc1cfd25bbbc2ae1d6fef5a1c261d69db4b1610733

Contents?: true

Size: 632 Bytes

Versions: 5

Compression:

Stored size: 632 Bytes

Contents

module Earth
  module EIA
    extend self

    def normalize(model, fields)
      model.all.each do |record|
        fields.each do |field|
          value = record.send field
          normalized_value = if value == 'Q'
                               0
                             elsif value == 'W'
                               0
                             elsif value == '*'
                               0
                             else
                               value
                             end
          record.send "#{field}=", normalized_value
        end
        record.save
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
earth-0.11.7 lib/earth/eia.rb
earth-0.11.6 lib/earth/eia.rb
earth-0.11.5 lib/earth/eia.rb
earth-0.11.4 lib/earth/eia.rb
earth-0.11.3 lib/earth/eia.rb