Class: PaperTrailDiff::AssociationDescriptor
- Inherits:
-
Object
- Object
- PaperTrailDiff::AssociationDescriptor
- Defined in:
- lib/paper_trail_diff/association_discovery.rb,
sig/generated/paper_trail_diff/association_discovery.rbs
Overview
One discoverable ActiveRecord association path.
Instance Attribute Summary collapse
- #cycle ⇒ Boolean readonly
- #kind ⇒ Symbol readonly
- #path ⇒ String readonly
- #polymorphic ⇒ Boolean readonly
- #target_type ⇒ String? readonly
- #through ⇒ String? readonly
Instance Method Summary collapse
-
#initialize(path:, kind:, target_type:, through: nil, flags: []) ⇒ AssociationDescriptor
constructor
: (path: String, kind: Symbol, target_type: String?, ?through: String?, ?flags: Array) -> void.
-
#to_h ⇒ Hash[Symbol, untyped]
: () -> Hash[Symbol, untyped].
Constructor Details
#initialize(path:, kind:, target_type:, through: nil, flags: []) ⇒ AssociationDescriptor
: (path: String, kind: Symbol, target_type: String?, ?through: String?, ?flags: Array) -> void
15 16 17 18 19 20 21 22 23 |
# File 'lib/paper_trail_diff/association_discovery.rb', line 15 def initialize(path:, kind:, target_type:, through: nil, flags: []) @path = Support.immutable_copy(path) @kind = kind @target_type = Support.immutable_copy(target_type) @through = Support.immutable_copy(through) @polymorphic = flags.include?(:polymorphic) @cycle = flags.include?(:cycle) freeze end |
Instance Attribute Details
#cycle ⇒ Boolean (readonly)
12 13 14 |
# File 'lib/paper_trail_diff/association_discovery.rb', line 12 def cycle @cycle end |
#kind ⇒ Symbol (readonly)
8 9 10 |
# File 'lib/paper_trail_diff/association_discovery.rb', line 8 def kind @kind end |
#path ⇒ String (readonly)
7 8 9 |
# File 'lib/paper_trail_diff/association_discovery.rb', line 7 def path @path end |
#polymorphic ⇒ Boolean (readonly)
11 12 13 |
# File 'lib/paper_trail_diff/association_discovery.rb', line 11 def polymorphic @polymorphic end |
#target_type ⇒ String? (readonly)
9 10 11 |
# File 'lib/paper_trail_diff/association_discovery.rb', line 9 def target_type @target_type end |
#through ⇒ String? (readonly)
10 11 12 |
# File 'lib/paper_trail_diff/association_discovery.rb', line 10 def through @through end |
Instance Method Details
#to_h ⇒ Hash[Symbol, untyped]
: () -> Hash[Symbol, untyped]
26 27 28 29 30 31 32 33 34 35 |
# File 'lib/paper_trail_diff/association_discovery.rb', line 26 def to_h { path: path, kind: kind, target_type: target_type, through: through, polymorphic: polymorphic, cycle: cycle } end |