lib/phonie/phone.rb in phonie-3.1.5 vs lib/phonie/phone.rb in phonie-3.1.6
- old
+ new
@@ -121,26 +121,26 @@
country_code: Phonie.configuration.default_country_code }
end
def normalize_args(args)
hash = if args.first.respond_to?(:key?)
- args.first
+ args.first
else
{}.tap do |h|
h[:number] = args[0] if args.length > 0
h[:area_code] = args[1] if args.length > 1
h[:country_code] = args[2] if args.length > 2
h[:extension] = args[3] if args.length > 3
h[:country] = args[4] if args.length > 4
- end
+ end
end
defaults.merge(hash)
end
def validate
[:country_code, :area_code, :number].each do |field|
- errors[field] = ["can't be blank"] if send(field).to_s == ''
+ errors[field] = ["can't be blank"] if send(field).to_s == ''
end
end
# split string into hash with keys :country_code, :area_code and :number
def self.split_to_parts(string, options = {})