Sha256: c5c21070143b965bace3aa3e89c6f4559a812fdfc9f650b95f78f77744ef2edc

Contents?: true

Size: 923 Bytes

Versions: 4

Compression:

Stored size: 923 Bytes

Contents

class Configuration
  DEFAULT_COUNTRIES = ["US", "GB", "AU", "IT", "RU", "NO"]
  attr_accessor :registered_operators, :default_countries, :custom_pstn_data_files

  def initialize
    @default_countries = DEFAULT_COUNTRIES
  end

  def default_countries=(value)
    @default_countries = value
    Torasup.load_international_dialing_codes!
  end

  def custom_pstn_data_file=(value)
    @custom_pstn_data_files ||= []
    value ? (@custom_pstn_data_files << value) : @custom_pstn_data_files.clear
    Torasup.load_pstn_data!
  end

  def register_operators(country_code, *operators)
    registered_operators[country_code] = operators
    Torasup.load_pstn_data!
  end

  def registered_operators=(value)
    @registered_operators = value
    Torasup.load_pstn_data!
  end

  def registered_operators
    @registered_operators ||= {}
  end

  def custom_pstn_data_files
    (@custom_pstn_data_files ||= []).compact
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
torasup-0.2.0 lib/torasup/configuration.rb
torasup-0.1.2 lib/torasup/configuration.rb
torasup-0.1.1 lib/torasup/configuration.rb
torasup-0.1.0 lib/torasup/configuration.rb