Class: ModelAuditor::Normalizers::ArrayDiff
- Inherits:
-
Object
- Object
- ModelAuditor::Normalizers::ArrayDiff
- Defined in:
- lib/model_auditor/normalizers/array_diff.rb
Instance Attribute Summary collapse
-
#changes ⇒ Object
readonly
Returns the value of attribute changes.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
Instance Method Summary collapse
-
#initialize(changes, key) ⇒ ArrayDiff
constructor
A new instance of ArrayDiff.
- #normalize ⇒ Object
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
#changes ⇒ Object (readonly)
Returns the value of attribute changes.
6 7 8 |
# File 'lib/model_auditor/normalizers/array_diff.rb', line 6 def changes @changes end |
#key ⇒ Object (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
#normalize ⇒ Object
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 |