Class: ModelAuditor::Normalizers::ArrayDiff

Inherits:
Object
  • Object
show all
Defined in:
lib/model_auditor/normalizers/array_diff.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(changes, key) ⇒ ArrayDiff

Returns a new instance of ArrayDiff.



8
9
10
11
# File 'lib/model_auditor/normalizers/array_diff.rb', line 8

def initialize(changes, key)
  @changes = changes
  @key = key
end

Instance Attribute Details

#changesObject (readonly)

Returns the value of attribute changes.



6
7
8
# File 'lib/model_auditor/normalizers/array_diff.rb', line 6

def changes
  @changes
end

#keyObject (readonly)

Returns the value of attribute key.



6
7
8
# File 'lib/model_auditor/normalizers/array_diff.rb', line 6

def key
  @key
end

Instance Method Details

#normalizeObject



13
14
15
16
17
# File 'lib/model_auditor/normalizers/array_diff.rb', line 13

def normalize
  diff.map do |title, value|
    humanize(title, value)
  end.join(', ')
end