Module: UF_BR

Defined in:
lib/validates_as_uf_br.rb

Constant Summary collapse

LIST_UP =
%w(AC AL AM AP BA CE DF ES GO MA MG MS MT PA PB PE PI PR RJ RN RO RR RS SC SE SP TO)
LIST_DOWN =
%w(ac al am ap ba ce df es go ma mg ms mt pa pb pe pi pr rj rn ro rr rs sc se sp to)

Class Method Summary collapse

Class Method Details

.invalid?(uf_br, allow_up = true, allow_down = true) ⇒ Boolean

Returns:

  • (Boolean)


9
10
11
# File 'lib/validates_as_uf_br.rb', line 9

def self.invalid?(uf_br, allow_up = true, allow_down = true)
  !valid?(uf_br, allow_up, allow_down)
end

.valid?(uf_br, allow_up = true, allow_down = true) ⇒ Boolean

Returns:

  • (Boolean)


5
6
7
# File 'lib/validates_as_uf_br.rb', line 5

def self.valid?(uf_br, allow_up = true, allow_down = true)
  (allow_up and LIST_UP.include? uf_br) or (allow_down and LIST_DOWN.include? uf_br)
end