Class: ZipFips::Handler

Inherits:
Object
  • Object
show all
Defined in:
lib/zipfips/handler.rb

Instance Method Summary collapse

Instance Method Details

#convert(code) ⇒ Object



13
14
15
# File 'lib/zipfips/handler.rb', line 13

def convert(code)
  is_zip?(code) ? to_fips(code) : to_zip(code)
end

#is_fips?(code) ⇒ Boolean



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

def is_fips?(code)
  !!zips_hash[code.to_s]
end

#is_zip?(code) ⇒ Boolean



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

def is_zip?(code)
  !!fips_hash[code.to_s] && !is_fips?(code)
end

#to_fips(code) ⇒ Object



21
22
23
# File 'lib/zipfips/handler.rb', line 21

def to_fips(code)
  fips_hash[code.to_s].to_i
end

#to_zip(code) ⇒ Object



17
18
19
# File 'lib/zipfips/handler.rb', line 17

def to_zip(code)
  zips_hash[code.to_s].to_i
end