Sha256: 9814ff57b588dde8937b05aba50f7a7c2a954c66f9a40f085dc300627eb99599

Contents?: true

Size: 678 Bytes

Versions: 3

Compression:

Stored size: 678 Bytes

Contents

module ISO3166
  class << self
    attr_writer :configuration
  end

  def self.configuration
    @configuration ||= Configuration.new
  end

  def self.reset
    @configuration = Configuration.new
    Data.reset
  end

  def self.configure
    yield(configuration)
  end

  class Configuration
    attr_accessor :locales, :loaded_locales

    def initialize
      @locales = default_locales
      @loaded_locales = []
    end

    private

    def default_locales
      locales = if Object.const_defined?('I18n') && I18n.respond_to?(:available_locales)
        I18n.available_locales
      else
        [:en]
      end

      locales.empty? ? [:en] : locales
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
countries-2.0.0.rc lib/countries/configuration.rb
countries-2.0.0.pre.4 lib/countries/configuration.rb
countries-2.0.0.pre.3 lib/countries/configuration.rb