HEX
Server: Apache
System: Linux s198.coreserver.jp 5.15.0-151-generic #161-Ubuntu SMP Tue Jul 22 14:25:40 UTC 2025 x86_64
User: nagasaki (10062)
PHP: 7.1.33
Disabled: NONE
Upload Files
File: //usr/local/rvm/gems/ruby-2.6.8/gems/globalid-0.5.2/lib/global_id/railtie.rb
begin
require 'rails/railtie'
rescue LoadError
else
require 'global_id'
require 'active_support'
require 'active_support/core_ext/string/inflections'
require 'active_support/core_ext/integer/time'

class GlobalID
  # = GlobalID Railtie
  # Set up the signed GlobalID verifier and include Active Record support.
  class Railtie < Rails::Railtie # :nodoc:
    config.global_id = ActiveSupport::OrderedOptions.new
    config.eager_load_namespaces << GlobalID

    initializer 'global_id' do |app|
      default_expires_in = 1.month
      default_app_name = app.railtie_name.remove('_application').dasherize

      GlobalID.app = app.config.global_id.app ||= default_app_name
      SignedGlobalID.expires_in = app.config.global_id.fetch(:expires_in, default_expires_in)

      config.after_initialize do
        GlobalID.app = app.config.global_id.app ||= default_app_name
        SignedGlobalID.expires_in = app.config.global_id.fetch(:expires_in, default_expires_in)

        app.config.global_id.verifier ||= begin
          GlobalID::Verifier.new(app.key_generator.generate_key('signed_global_ids'))
        rescue ArgumentError
          nil
        end
        SignedGlobalID.verifier = app.config.global_id.verifier
      end

      ActiveSupport.on_load(:active_record) do
        require 'global_id/identification'
        send :include, GlobalID::Identification
      end
    end
  end
end

end