Sha256: 1086ffd93ea90457fbd4b9abe68ff4e617a09ac544dfd5b50c858194dbf80d25

Contents?: true

Size: 1.2 KB

Versions: 1

Compression:

Stored size: 1.2 KB

Contents

# frozen_string_literal: true

require_relative "tanshuku/configuration"
require_relative "tanshuku/engine"
require_relative "tanshuku/version"

# Tanshuku’s namespace.
module Tanshuku
  # Returns a configuration object for Tanshuku.
  #
  # @return [Tanshuku::Configuration]
  #
  # @note
  #   Mutating a {Tanshuku::Configuration} object is thread-<em><b>unsafe</b></em>. It is recommended to use
  #   {Tanshuku.configure} for configuration.
  def self.config
    # Disable this cop but use `Tanshuku::Configuration#configure` for thread-safety.
    # rubocop:disable ThreadSafety/ClassInstanceVariable
    @config ||= Configuration.new
    # rubocop:enable ThreadSafety/ClassInstanceVariable
  end

  # Configures Tanshuku.
  #
  # @yieldparam config [Tanshuku::Configuration] A configuration object that is yielded.
  # @yieldreturn [void]
  #
  # @return [void]
  #
  # @note
  #   This method is thread-safe. When mutating a {Tanshuku::Configuration} object for configuration, it is recommended
  #   to use this method.
  #
  # @example
  #   Tanshuku.configure do |config|
  #     config.default_url_options = { host: "localhost", protocol: :https }
  #   end
  def self.configure(&)
    config.configure(&)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tanshuku-4.0.0 lib/tanshuku.rb