Sha256: 9272e8ea0da5f491d2435ca2405adf62a30b583293fa82262c553fa0c89111c9
Contents?: true
Size: 980 Bytes
Versions: 1
Compression:
Stored size: 980 Bytes
Contents
# frozen_string_literal: true module Logux class ActionCaller attr_reader :action, :meta delegate :logger, to: :Logux def initialize(action:, meta:) @action = action @meta = meta end def call! Logux::Model::UpdatesDeprecator.watch(level: :error) do logger.debug( "Searching action for Logux action: #{action}, meta: #{meta}" ) format(action_controller.public_send(action.action_type)) end rescue Logux::UnknownActionError, Logux::UnknownChannelError => e logger.warn(e) format(nil) end private def format(response) return response if response.is_a?(Logux::Response) Logux::Response.new(:processed, action: action, meta: meta) end def class_finder @class_finder ||= Logux::ClassFinder.new(action: action, meta: meta) end def action_controller class_finder.find_action_class.new(action: action, meta: meta) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
logux_rails-0.1.0 | lib/logux/action_caller.rb |