lib/phonelib/core.rb in phonelib-0.2.0 vs lib/phonelib/core.rb in phonelib-0.2.1

- old
+ new

@@ -3,13 +3,22 @@ module Core # variable will include hash with data for validation @@phone_data = nil # default country for parsing variable setting - mattr_accessor :default_country @@default_country = nil + # getter method for default_country variable + def default_country + @@default_country + end + + # setter method for default_country variable + def default_country=(country) + @@default_country = country + end + # gem constants definition # constants for phone types # Validation patterns keys constants # General pattern for country key @@ -116,16 +125,14 @@ parse(phone_number).impossible? end # method checks if passed phone number is valid for provided country def valid_for_country?(phone_number, country) - country = country.to_s.upcase parse(phone_number, country).valid_for_country?(country) end # method checks if passed phone number is invalid for provided country def invalid_for_country?(phone_number, country) - country = country.to_s.upcase parse(phone_number, country).invalid_for_country?(country) end private # Load data file into memory