Sha256: 13a02ea8c961ddaf9db74469d37ac6d2e040aab0de082529d32dd4a2cefe284d

Contents?: true

Size: 999 Bytes

Versions: 3

Compression:

Stored size: 999 Bytes

Contents

# frozen_string_literal: true

module Lite
  module Uxid

    class Configuration

      attr_accessor :hashid_charset, :hashid_size, :hashid_salt,
                    :nanoid_charset, :nanoid_size,
                    :ulid_charset,   :ulid_size,
                    :uuid_version

      def initialize
        @hashid_charset = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
        @hashid_salt = 1_369_136
        @hashid_size = 16
        @nanoid_charset = "_-0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
        @nanoid_size = 21
        @ulid_charset = "0123456789ABCDEFGHJKMNPQRSTVWXYZ"
        @ulid_size = 26
        @uuid_version = 4
      end

    end

    class << self

      attr_writer :configuration

      def configuration
        @configuration ||= Configuration.new
      end

      def configure
        yield(configuration)
      end

      def reset_configuration!
        @configuration = Configuration.new
      end

    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
lite-uxid-1.5.2 lib/lite/uxid/configuration.rb
lite-uxid-1.5.1 lib/lite/uxid/configuration.rb
lite-uxid-1.5.0 lib/lite/uxid/configuration.rb