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
52 53 54 55 56 57 |
# File 'lib/paper_trail_diff/value_objects.rb', line 52 def initialize(kind:, relationship:, changed:) @kind = kind @relationship = relationship @changed = changed freeze end |
Instance Attribute Details
#changed ⇒ RecordChange? (readonly)
49 50 51 |
# File 'lib/paper_trail_diff/value_objects.rb', line 49 def changed @changed end |
#kind ⇒ Symbol (readonly)
47 48 49 |
# File 'lib/paper_trail_diff/value_objects.rb', line 47 def kind @kind end |
#relationship ⇒ ValueChange? (readonly)
48 49 50 |
# File 'lib/paper_trail_diff/value_objects.rb', line 48 def relationship @relationship end |
Instance Method Details
#empty? ⇒ Boolean
: () -> bool
60 61 62 |
# File 'lib/paper_trail_diff/value_objects.rb', line 60 def empty? relationship.nil? && changed.nil? end |