Module: LocoMotion::Patches::ViewComponent::SlotPatch
- Defined in:
- lib/loco_motion/patches/view_component/slot_loco_parent_patch.rb
Instance Method Summary collapse
-
#__vc_component_instance=(instance) ⇒ Object
Set the loco parent any time the instance changes.
- #set_loco_parent(parent = @parent) ⇒ Object
- #to_s ⇒ Object
Instance Method Details
#__vc_component_instance=(instance) ⇒ Object
Set the loco parent any time the instance changes
9 10 11 12 13 14 15 |
# File 'lib/loco_motion/patches/view_component/slot_loco_parent_patch.rb', line 9 def __vc_component_instance=(instance) # Call the original implementation super # And set the Loco parent set_loco_parent end |
#set_loco_parent(parent = @parent) ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/loco_motion/patches/view_component/slot_loco_parent_patch.rb', line 23 def set_loco_parent(parent = @parent) return if parent.nil? return if @__vc_component_instance.nil? return if @__vc_component_instance.loco_parent.present? @__vc_component_instance.set_loco_parent(parent) end |
#to_s ⇒ Object
17 18 19 20 21 |
# File 'lib/loco_motion/patches/view_component/slot_loco_parent_patch.rb', line 17 def to_s set_loco_parent super end |