Sha256: aa07eacc88f01a8b1bee74be068b2e53f81eaf88900148f4052873d4bc2d5243
Contents?: true
Size: 983 Bytes
Versions: 1
Compression:
Stored size: 983 Bytes
Contents
# frozen_string_literal: true module Logux class ActionCaller extend Forwardable attr_reader :action, :meta def_delegator :Logux, :logger def initialize(action:, meta:) @action = action @meta = meta end def call! Logux.watch_action { call_action } rescue Logux::UnknownActionError, Logux::UnknownChannelError => e logger.warn(e) format(nil) end protected def call_action logger.debug("Searching Logux action: #{action}, meta: #{meta}") format(action_controller.public_send(action.action_type)) 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-rack-0.1.0 | lib/logux/action_caller.rb |