lib/bic_validation/bic.rb in bic_validation-0.1.0 vs lib/bic_validation/bic.rb in bic_validation-0.2.0
- old
+ new
@@ -2,11 +2,11 @@
module BicValidation
class Bic
def initialize(code)
- @code = code.strip.upcase
+ @code = code.to_s.strip.upcase
end
def of_valid_length?
[8, 11].include? @code.length
end
@@ -32,9 +32,13 @@
def valid?
of_valid_length? &&
of_valid_format? &&
has_valid_country_code? &&
has_valid_branch_code?
+ end
+
+ def invalid?
+ !valid?
end
def bank
match[1]
end