Class: PaperTrailDiff::ToOneAssociationDiff
- Inherits:
-
Object
- Object
- PaperTrailDiff::ToOneAssociationDiff
- Defined in:
- lib/paper_trail_diff/value_objects.rb,
sig/generated/paper_trail_diff/value_objects.rbs
Overview
Relationship and associated-record changes for belongs_to or has_one.
Instance Attribute Summary collapse
- #changed ⇒ RecordChange? readonly
- #kind ⇒ Symbol readonly
- #relationship ⇒ ValueChange? readonly
Instance Method Summary collapse
-
#empty? ⇒ Boolean
: () -> bool.
-
#initialize(kind:, relationship:, changed:) ⇒ ToOneAssociationDiff
constructor
: (kind: Symbol, relationship: ValueChange?, changed: RecordChange?) -> void.
-
#to_h ⇒ Hash[Symbol, untyped]
: () -> Hash[Symbol, untyped].
Constructor Details
#initialize(kind:, relationship:, changed:) ⇒ ToOneAssociationDiff
: (kind: Symbol, relationship: ValueChange?, changed: RecordChange?) -> void
118 119 120 121 122 123 |
# File 'lib/paper_trail_diff/value_objects.rb', line 118 def initialize(kind:, relationship:, changed:) @kind = kind @relationship = relationship @changed = changed freeze end |
Instance Attribute Details
#changed ⇒ RecordChange? (readonly)
115 116 117 |
# File 'lib/paper_trail_diff/value_objects.rb', line 115 def changed @changed end |
#kind ⇒ Symbol (readonly)
113 114 115 |
# File 'lib/paper_trail_diff/value_objects.rb', line 113 def kind @kind end |
#relationship ⇒ ValueChange? (readonly)
114 115 116 |
# File 'lib/paper_trail_diff/value_objects.rb', line 114 def relationship @relationship end |
Instance Method Details
#empty? ⇒ Boolean
: () -> bool
126 127 128 |
# File 'lib/paper_trail_diff/value_objects.rb', line 126 def empty? relationship.nil? && changed.nil? end |