Sha256: 7a87b39788d8650df4b9ac482cbcd331df7c7edc577eb7a3a4d01d80e4a19046

Contents?: true

Size: 445 Bytes

Versions: 9

Compression:

Stored size: 445 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
    Journaled::Current.actor&.to_global_id&.to_s
  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

9 entries across 9 versions & 1 rubygems

Version Path
journaled-5.3.1 app/models/journaled/actor_uri_provider.rb
journaled-5.3.0 app/models/journaled/actor_uri_provider.rb
journaled-5.2.0 app/models/journaled/actor_uri_provider.rb
journaled-5.1.1 app/models/journaled/actor_uri_provider.rb
journaled-5.1.0 app/models/journaled/actor_uri_provider.rb
journaled-5.0.0 app/models/journaled/actor_uri_provider.rb
journaled-4.3.0 app/models/journaled/actor_uri_provider.rb
journaled-4.2.0 app/models/journaled/actor_uri_provider.rb
journaled-4.1.0 app/models/journaled/actor_uri_provider.rb