Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.
# frozen_string_literal: true
module Chat
module WithServiceHelper
def result
@_result
end
def with_service(service, default_actions: true, **dependencies, &block)
object = self
merged_block =
proc do
instance_exec(&object.method(:default_actions_for_service).call) if default_actions
instance_exec(&(block || proc {}))
Chat::ServiceRunner.call(service, object, **dependencies, &merged_block)
def run_service(service, dependencies)
@_result = service.call(params.to_unsafe_h.merge(guardian: guardian, **dependencies))
def default_actions_for_service
proc {}