Module: Nomener::Suffixes

Extended by:
Base
Defined in:
lib/nomener/suffixes.rb

Overview

Module for suffix information

Constant Summary collapse

SUFFIXES =

Internal: Regex to match suffixes or honorifics after names

%r/(?<=\p{^Alpha})(?:
  AB                                           # Bachelor of Arts
  | APC
  | Attorney[\p{Blank}\-]at[\p{Blank}\-]Law\.? # Attorney at Law
  | B[AS]c?                                    # Bachelor of Arts,Science
  | C\.?P\.?A\.?
  | CHB
  | DBE
  | D\.?[DMOPV]\.?[SMD]?\.?                    # DMD, DO, DPM, DDM, DVM
  | DSC
  | Esq(?:\.|uire\.?)?                         # Esq, Esquire
  | FAC(?:P|S)                                 # FACP, FACS
  | fils
  | FRSL
  | (?:[VX]?I{1,3})(?!\.)                      # roman numbers
  | (?:IX|IV|V|VI|XI)(?!\.)                    # roman numbers
  | (?:X{1,3})(?!\.)                           # roman numbers
  | Jn?r\.?
  | Junior
  | LLB
  | M\.?[BDS]\.?ed?                            # MB, MD, MS, MSed
  | MPH
  | P\.?\p{Blank}?A\.?
  | PC
  | p[èe]re
  | Ph\.?\p{Blank}?D\.?
  | RN
  | SC
  | Sn?r\.?                                    # Snr, Sr
  | Senior
  | V\.?M\.?D\.?
)(?=[^\p{Alpha}\p{Blank}]+|\z)/x

Constants included from Base

Base::PERIOD

Class Method Summary collapse

Methods included from Base

dustoff, gut!

Class Method Details

.parse_suffix!(nm) ⇒ Object

Internal: pull off what suffixes we can

Modifies given string in place.

nm - string of the name to parse

Returns string of the suffixes found or and empty string



49
50
51
52
53
54
55
# File 'lib/nomener/suffixes.rb', line 49

def self.parse_suffix!(nm)
  return '' if nm.to_s.empty?

  suffix = dustoff gut!(nm, SUFFIXES)
  Cleaner.cleanup! nm
  suffix
end