Method: RussianPhone::Number.process_options

Defined in:
lib/russian_phone/number.rb

.process_options(opts = {}) ⇒ Object



187
188
189
190
191
192
193
194
195
196
197
198
199
# File 'lib/russian_phone/number.rb', line 187

def process_options(opts = {})
  opts = {
      default_country: 7,
      default_city: nil,
      allowed_cities: nil,
  }.merge(opts)

  opts[:default_country] = opts[:default_country].to_s unless opts[:default_country].nil?
  opts[:default_city]    = opts[:default_city].to_s    unless opts[:default_city].nil?
  opts[:allowed_cities]  = opts[:allowed_cities].map { |c| c.to_s } unless opts[:allowed_cities].nil?

  opts
end