Sha256: 28394867a33e6886c41663794a2755bbaf7c873932ca649ee704f4073c4223e0

Contents?: true

Size: 633 Bytes

Versions: 20

Compression:

Stored size: 633 Bytes

Contents

require 'singleton'

module Phonie
  class Configuration
    include Singleton

    attr_accessor :data_file_path, :default_area_code, :default_country_code, :n1_length

    def initialize
      @data_file_path = File.join(File.dirname(__FILE__), 'data', 'phone_countries.yml')
      @n1_length = 3
      @named_formats = {}
    end

    def add_custom_named_format(name, format_string)
      @named_formats[name.to_sym] = format_string
    end

    def custom_named_formats
      @named_formats
    end
  end

  def self.configure(&block)
    yield configuration
  end

  def self.configuration
    Configuration.instance
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
phonie-3.3.1 lib/phonie/configuration.rb
phonie-3.2.2 lib/phonie/configuration.rb
phonie-3.2.1 lib/phonie/configuration.rb
phonie-3.2.0 lib/phonie/configuration.rb
phonie-3.1.15 lib/phonie/configuration.rb
phonie-3.1.14 lib/phonie/configuration.rb
phonie-3.1.13 lib/phonie/configuration.rb
phonie-3.1.12 lib/phonie/configuration.rb
phonie-3.1.11 lib/phonie/configuration.rb
phonie-3.1.10 lib/phonie/configuration.rb
phonie-3.1.9 lib/phonie/configuration.rb
phonie-3.1.8 lib/phonie/configuration.rb
phonie-3.1.7 lib/phonie/configuration.rb
phonie-3.1.6 lib/phonie/configuration.rb
phonie-3.1.5 lib/phonie/configuration.rb
phonie-3.1.4 lib/phonie/configuration.rb
phonie-3.1.3 lib/phonie/configuration.rb
phonie-3.1.2 lib/phonie/configuration.rb
phonie-3.1.1 lib/phonie/configuration.rb
phonie-3.1.0 lib/phonie/configuration.rb