lib/validates_telephone/validator.rb in validates_telephone-1.1.0 vs lib/validates_telephone/validator.rb in validates_telephone-2.0.0
- old
+ new
@@ -1,14 +1,15 @@
module ValidatesTelephone
class Validator
def initialize(number, locale = :any)
+ locale ||= :any
@number = number
@match = ValidatesTelephone::Regex.send(locale, @number)
@number = ValidatesTelephone::Formatter.send(locale, @number)
end
def valid?
- return true if @number.nil?
+ return true if @number.blank?
@match
end
def number
@number
\ No newline at end of file