Sha256: 7053c58ba31cd5ef41d6959433183bae1d4ec27bc5c1e2aeb7eab83d193db250

Contents?: true

Size: 1.26 KB

Versions: 1

Compression:

Stored size: 1.26 KB

Contents

module Nameable
  class Latin
    ##
    # Regex's to match the detritus that people add to their names
    module Patterns
      PREFIX = {
        "Mr."    => /^\(*(mr\.*|mister)\)*$/i,
        "Mrs."   => /^\(*(mrs\.*|misses)\)*$/i,
        "Ms."    => /^\(*(ms\.*|miss)\)*$/i,
        "Dr."    => /^\(*(dr\.*|doctor)\)*$/i,
        "Rev."   => /^\(*(rev\.*|reverend)\)*$/i,
        "Fr."    => /^\(*(fr\.*|friar)\)*$/i,
        "Master" => /^\(*(master)\)*$/i,
        "Sir"    => /^\(*(sir)\)*$/i
      }

      SUFFIX = {
        "Sr."   => /^\(*(sr\.?|senior)\)*$/i,
        "Jr."   => /^\(*(jr\.?|junior)\)*$/i,
        "Esq."  => /^\(*(esq\.?|esquire)\)*$/i,
        "Ph.D." => /^\(*(p\.?h\.?d\.?)\)*$/i
      }

      SUFFIX_GENERATIONAL_ROMAN = /^\(*[IVX.]+\)*$/i
      SUFFIX_ACADEMIC = /^(APR|RPh|MD|MA|DMD|DDS|PharmD|EngD|DPhil|JD|DD|DO|BA|BS|BSc|BE|BFA|MA|MS|MSc|MFA|MLA|MBA)$/i
      SUFFIX_PROFESSIONAL = /^(PE|CSA|CPA|CPL|CME|CEng|OFM|CSV|Douchebag)$/i
      SUFFIX_ABBREVIATION = /^[A-Z.]+[A-Z.]+$/  # It should be at least 2 letters

      # http://www.onlineaspect.com/2009/08/17/splitting-names/
      LAST_NAME_PRE_DANGLERS = /^(mc|vere|von|van|da|de|del|della|di|da|pietro|vanden|du|st|la|ter|ten)$/i
      O_LAST_NAME_PRE_CONCATS = /^(o'|o`|o")$/i
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
nameable-1.1.3 lib/nameable/latin/patterns.rb