Module: ViaCep::Validators::State
- Defined in:
- lib/via_cep/validators.rb
Class Method Summary collapse
-
.valid?(state) ⇒ Boolean
Validates if the state passed is a valid one.
Class Method Details
.valid?(state) ⇒ Boolean
Validates if the state passed is a valid one.
Return if is valid or not
ViaCep::Validators::State.valid?('foo')
#=> false
ViaCep::Validators::State.valid?('RJ')
#=> true
return Boolean
18 19 20 21 22 23 24 |
# File 'lib/via_cep/validators.rb', line 18 def valid?(state) %w[ AC AL AP AM BA CE DF ES GO MA MT MS MG PR PB PA PE PI RJ RN RS RO RR SC SE SP TO ].include?(state.to_s) end |