Module: Motion::Component::Lifecycle

Extended by:
ActiveSupport::Concern
Includes:
ActiveSupport::Callbacks
Included in:
Motion::Component
Defined in:
lib/motion/component/lifecycle.rb

Instance Method Summary collapse

Instance Method Details

#_run_action_callbacks(context:, &block) ⇒ Object



103
104
105
106
107
108
109
# File 'lib/motion/component/lifecycle.rb', line 103

def _run_action_callbacks(context:, &block)
  @_action_callback_context = context

  run_callbacks(:action, &block)
ensure
  @_action_callback_context = nil
end

#process_connectObject



73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/motion/component/lifecycle.rb', line 73

def process_connect
  _run_connect_callbacks

  # TODO: Remove at next minor release
  if respond_to?(:connected)
    ActiveSupport::Deprecation.warn(
      "The `connected` lifecycle method is being replaced by the " \
      "`after_connect` callback and will no longer be automatically " \
      "invoked in the next **minor release** of Motion."
    )

    send(:connected)
  end
end

#process_disconnectObject



88
89
90
91
92
93
94
95
96
97
98
99
100
101
# File 'lib/motion/component/lifecycle.rb', line 88

def process_disconnect
  _run_disconnect_callbacks

  # TODO: Remove at next minor release
  if respond_to?(:disconnected)
    ActiveSupport::Deprecation.warn(
      "The `disconnected` lifecycle method is being replaced by the " \
      "`after_disconnect` callback and will no longer be automatically " \
      "invoked in the next **minor release** of Motion."
    )

    send(:disconnected)
  end
end