Sha256: 2faaeb97cbbe8087e19b5e9a5c5b548e7d4569810969817205fd213f4b4588c8

Contents?: true

Size: 931 Bytes

Versions: 2

Compression:

Stored size: 931 Bytes

Contents

# frozen_string_literal: true

require 'model_auditor/version'

module ModelAuditor
  autoload :AttributeReader, 'model_auditor/attribute_reader'
  autoload :Changes, 'model_auditor/changes'

  module AttributeReaders
    autoload :Associated, 'model_auditor/attribute_readers/associated'
    autoload :ArrayField, 'model_auditor/attribute_readers/array_field'
    autoload :String, 'model_auditor/attribute_readers/string'
  end

  module Normalizers
    autoload :ArrayDiff, 'model_auditor/normalizers/array_diff'
    autoload :String, 'model_auditor/normalizers/string'
  end

  def self.normalize_value(value)
    case value
    when Date then value.strftime('%d.%m.%Y')
    when DateTime, Time then value.strftime('%d.%m.%Y %H:%M')
    when String then Normalizers::String.new(value).normalize
    when BigDecimal then value.to_f
    when Hash, Array then value.inspect.gsub(/[\"\r\n\t]/, '')
    else value
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
model_auditor-0.0.2 lib/model_auditor.rb
model_auditor-0.0.1 lib/model_auditor.rb