Sha256: 08dfc78c0ef205145108ac65608f145afae2af1a472d1522f1d7cc360ad0e515

Contents?: true

Size: 493 Bytes

Versions: 15

Compression:

Stored size: 493 Bytes

Contents

class Journaled::ActorUriProvider
  include Singleton

  def actor_uri
    actor_global_id_uri || fallback_global_id_uri
  end

  private

  def actor_global_id_uri
    actor = RequestStore.store[:journaled_actor_proc]&.call
    actor.to_global_id.to_s if actor
  end

  def fallback_global_id_uri
    if defined?(::Rails::Console) || File.basename($PROGRAM_NAME) == "rake"
      "gid://local/#{Etc.getlogin}"
    else
      "gid://#{Rails.application.config.global_id.app}"
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
journaled-4.0.0 app/models/journaled/actor_uri_provider.rb
journaled-3.1.0 app/models/journaled/actor_uri_provider.rb
journaled-3.0.0 app/models/journaled/actor_uri_provider.rb
journaled-2.5.0 app/models/journaled/actor_uri_provider.rb
journaled-2.4.0 app/models/journaled/actor_uri_provider.rb
journaled-2.3.1 app/models/journaled/actor_uri_provider.rb
journaled-2.3.0 app/models/journaled/actor_uri_provider.rb
journaled-2.2.0 app/models/journaled/actor_uri_provider.rb
journaled-2.1.1 app/models/journaled/actor_uri_provider.rb
journaled-2.1.0 app/models/journaled/actor_uri_provider.rb
journaled-2.0.3 app/models/journaled/actor_uri_provider.rb
journaled-2.0.2 app/models/journaled/actor_uri_provider.rb
journaled-2.0.1 app/models/journaled/actor_uri_provider.rb
journaled-2.0.0 app/models/journaled/actor_uri_provider.rb
journaled-2.0.0.rc1 app/models/journaled/actor_uri_provider.rb