Class: GovCodes::Dafecd::SpecialtyParser
- Inherits:
-
Object
- Object
- GovCodes::Dafecd::SpecialtyParser
- Defined in:
- lib/gov_codes/dafecd/specialty_parser.rb
Overview
Parses a single specialty record (as produced by RecordSplitter) into a structured header: X-form specialty, career field, CEM code (enlisted), per-specialty change date, skill/qualification ladder, and the (conservatively normalized) specialty title.
Behavior is publication-specific (injected Publication); the default is the enlisted directory.
Deliberately does NOT attempt to de-glue titles that pdf-reader ran together (e.g. "FORCEAVIATOR" / "SPECIALWARFARE"). Such titles are title-cased verbatim and flagged via :glued_title so the deferred LLM despacer can address them.
Constant Summary collapse
- DECORATIVE =
Patterns::DECORATIVE
- UNICODE_DASHES =
Patterns::UNICODE_DASHES
Instance Method Summary collapse
-
#initialize(record, publication: Publication.dafecd) ⇒ SpecialtyParser
constructor
A new instance of SpecialtyParser.
- #parse ⇒ Object
Constructor Details
#initialize(record, publication: Publication.dafecd) ⇒ SpecialtyParser
Returns a new instance of SpecialtyParser.
25 26 27 28 29 |
# File 'lib/gov_codes/dafecd/specialty_parser.rb', line 25 def initialize(record, publication: Publication.dafecd) @publication = publication @record = Text.split_glued_afsc(record, publication.glued_afsc) @lines = @record.lines end |
Instance Method Details
#parse ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/gov_codes/dafecd/specialty_parser.rb', line 31 def parse codes = ladder_codes { specialty: specialty(codes), career_field: career_field(codes), cem_code: cem_code, bare_code: , changed_date: changed_date, name: name, raw_title: raw_title, glued_title: glued_title? }.merge(@publication.levels_key => levels) end |