Sha256: efbd4309223bc8c53ba3c3d61dbc2fd5c7fbe002241012c15dc949dd7635399e
Contents?: true
Size: 599 Bytes
Versions: 3
Compression:
Stored size: 599 Bytes
Contents
class StandardizeNumbers def initialize(record, attributes) @attributes = attributes if @attributes.kind_of?(Array) @attributes.each do |attribute| unless record[attribute].nil? value = record[attribute] if !(value =~ /\.\d+\,/).nil? value = value.gsub(/[.,]/, ',' => '.', '.' => '_') elsif !(value =~ /\,\d+\./).nil? value = value.gsub(/\,/, '_') elsif !(value =~ /\,/).nil? value = value.gsub(/\,/, '.') end record[attribute] = value end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
rdcms-1.0.28 | app/models/standardize_numbers.rb |
rdcms-1.0.27 | app/models/standardize_numbers.rb |
rdcms-1.0.26 | app/models/standardize_numbers.rb |