class LogBook::Recorder::RecordingChanges

Attributes

action[R]
author[R]
meta[R]
record_changes[R]
recording_key[RW]
request_uuid[R]
subject[R]

Public Class Methods

new(recorder) click to toggle source
# File lib/log_book/recorder.rb, line 122
def initialize(recorder)
  @subject = recorder
  @recording_key = subject.recording_key
  @record_changes = {}
  @meta = {}
end

Public Instance Methods

changes?() click to toggle source
# File lib/log_book/recorder.rb, line 137
def changes?
  meta.present? || record_changes.present?
end
children() click to toggle source
# File lib/log_book/recorder.rb, line 153
def children
  self.class.new(subject.send(subject.recording_options[:parent_of])) if subject.recording_options[:parent_of]
end
meta=(value) click to toggle source
# File lib/log_book/recorder.rb, line 133
def meta=(value)
  @meta.merge!(value)
end
parent() click to toggle source
# File lib/log_book/recorder.rb, line 149
def parent
  self.class.new(subject.send(subject.recording_options[:parent])) if subject.recording_options[:parent]
end
record_changes=(value) click to toggle source
# File lib/log_book/recorder.rb, line 129
def record_changes=(value)
  @record_changes.merge!(value)
end
subject_id() click to toggle source
# File lib/log_book/recorder.rb, line 145
def subject_id
  subject.id
end
subject_key() click to toggle source
# File lib/log_book/recorder.rb, line 141
def subject_key
  subject.class.table_name
end
to_h() click to toggle source
# File lib/log_book/recorder.rb, line 157
def to_h
  {
    subject: subject,
    record_changes: record_changes,
    meta: meta
  }
end