class Diffit::Record
Attributes
changes[R]
model[R]
record_id[R]
Public Class Methods
new(model, record_id, changes)
click to toggle source
# File lib/diffit/record.rb, line 6 def initialize(model, record_id, changes) @model = model @record_id = record_id @changes = changes end
Public Instance Methods
last_changed_at()
click to toggle source
Timestamp of the latest change.
@return [Time] latest change timestamp.
# File lib/diffit/record.rb, line 15 def last_changed_at @last_changed_at ||= @changes.map { |c| c[:changed_at] }.max end
to_h()
click to toggle source
A ‘Hash` representation of `self`.
@return [Hash] the object converted to hash.
# File lib/diffit/record.rb, line 22 def to_h {model: model, record_id: record_id, changes: changes} end