Sha256: 1d640c247e1c7d46b914a135b2b7b48673276af575cc64effaf885957b356c12

Contents?: true

Size: 624 Bytes

Versions: 2

Compression:

Stored size: 624 Bytes

Contents

# frozen_string_literal: true

module Journaled::Actor
  extend ActiveSupport::Concern

  included do
    class_attribute :_journaled_actor_method_name, instance_writer: false
    before_action :_set_journaled_actor_proc, if: :_journaled_actor_method_name?
  end

  private

  def _set_journaled_actor_proc
    Journaled::Current.journaled_actor_proc = -> { send(self.class._journaled_actor_method_name) }
  end

  class_methods do
    def journaled_actor=(method_name)
      raise "Must provide a symbol method name" unless method_name.is_a?(Symbol)

      self._journaled_actor_method_name = method_name
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
journaled-6.0.0 app/controllers/concerns/journaled/actor.rb
journaled-5.3.2 app/controllers/concerns/journaled/actor.rb