Class: LogBook::Recorder::RecordingChanges
- Inherits:
-
Object
- Object
- LogBook::Recorder::RecordingChanges
- Defined in:
- lib/log_book/recorder.rb
Instance Attribute Summary collapse
-
#action ⇒ Object
readonly
Returns the value of attribute action.
-
#author ⇒ Object
readonly
Returns the value of attribute author.
-
#meta ⇒ Object
Returns the value of attribute meta.
-
#record_changes ⇒ Object
Returns the value of attribute record_changes.
-
#recording_key ⇒ Object
Returns the value of attribute recording_key.
-
#request_uuid ⇒ Object
readonly
Returns the value of attribute request_uuid.
-
#subject ⇒ Object
readonly
Returns the value of attribute subject.
Instance Method Summary collapse
- #changes? ⇒ Boolean
- #children ⇒ Object
-
#initialize(recorder) ⇒ RecordingChanges
constructor
A new instance of RecordingChanges.
- #parent ⇒ Object
- #subject_id ⇒ Object
- #subject_key ⇒ Object
- #to_h ⇒ Object
Constructor Details
#initialize(recorder) ⇒ RecordingChanges
122 123 124 125 126 127 |
# File 'lib/log_book/recorder.rb', line 122 def initialize(recorder) @subject = recorder @recording_key = subject.recording_key @record_changes = {} = {} end |
Instance Attribute Details
#action ⇒ Object (readonly)
Returns the value of attribute action.
115 116 117 |
# File 'lib/log_book/recorder.rb', line 115 def action @action end |
#author ⇒ Object (readonly)
Returns the value of attribute author.
116 117 118 |
# File 'lib/log_book/recorder.rb', line 116 def end |
#meta ⇒ Object
Returns the value of attribute meta.
118 119 120 |
# File 'lib/log_book/recorder.rb', line 118 def end |
#record_changes ⇒ Object
Returns the value of attribute record_changes.
117 118 119 |
# File 'lib/log_book/recorder.rb', line 117 def record_changes @record_changes end |
#recording_key ⇒ Object
Returns the value of attribute recording_key.
120 121 122 |
# File 'lib/log_book/recorder.rb', line 120 def recording_key @recording_key end |
#request_uuid ⇒ Object (readonly)
Returns the value of attribute request_uuid.
119 120 121 |
# File 'lib/log_book/recorder.rb', line 119 def request_uuid @request_uuid end |
#subject ⇒ Object (readonly)
Returns the value of attribute subject.
114 115 116 |
# File 'lib/log_book/recorder.rb', line 114 def subject @subject end |
Instance Method Details
#changes? ⇒ Boolean
137 138 139 |
# File 'lib/log_book/recorder.rb', line 137 def changes? .present? || record_changes.present? end |
#children ⇒ Object
153 154 155 |
# File 'lib/log_book/recorder.rb', line 153 def children self.class.new(subject.send(subject.[:parent_of])) if subject.[:parent_of] end |
#parent ⇒ Object
149 150 151 |
# File 'lib/log_book/recorder.rb', line 149 def parent self.class.new(subject.send(subject.[:parent])) if subject.[:parent] end |
#subject_id ⇒ Object
145 146 147 |
# File 'lib/log_book/recorder.rb', line 145 def subject_id subject.id end |
#subject_key ⇒ Object
141 142 143 |
# File 'lib/log_book/recorder.rb', line 141 def subject_key subject.class.table_name end |
#to_h ⇒ Object
157 158 159 160 161 162 163 |
# File 'lib/log_book/recorder.rb', line 157 def to_h { subject: subject, record_changes: record_changes, meta: } end |