Sha256: 9d5fc03babab719708c424c5168bd2db17afab9b11f8e8e91bcbdd520cd49d69

Contents?: true

Size: 1.21 KB

Versions: 6

Compression:

Stored size: 1.21 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/InstanceVariableInClassMethod
    @config ||= Configuration.new
    # rubocop:enable ThreadSafety/InstanceVariableInClassMethod
  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

6 entries across 6 versions & 1 rubygems

Version Path
tanshuku-0.0.19 lib/tanshuku.rb
tanshuku-0.0.18 lib/tanshuku.rb
tanshuku-0.0.17 lib/tanshuku.rb
tanshuku-0.0.16 lib/tanshuku.rb
tanshuku-0.0.15 lib/tanshuku.rb
tanshuku-0.0.14 lib/tanshuku.rb