Class: GovCodes::AFSC::RI::Parser

Inherits:
Object
  • Object
show all
Defined in:
lib/gov_codes/afsc/ri.rb

Instance Method Summary collapse

Constructor Details

#initialize(code) ⇒ Parser

Returns a new instance of Parser.



20
21
22
# File 'lib/gov_codes/afsc/ri.rb', line 20

def initialize(code)
  @code = code.to_s
end

Instance Method Details

#parseObject

Try the 5-char enlisted shape first, then the 4-char officer shape. Both shapes are mutually exclusive (an enlisted code's 2nd char is a letter; an officer code's 2nd char is a digit), so at most one matches. The result carries the decomposed fields plus the :publication whose index should resolve the name; all nil when neither shape parses.



29
30
31
# File 'lib/gov_codes/afsc/ri.rb', line 29

def parse
  parse_enlisted || parse_officer || empty_result
end