lib/noble_names/match_index.rb
# Checks weither a word has a prefix as defined in
# the MatchIndexs data and returns it.
# @param [String] word the word that needs to be checked.
# @return [String] pre the Prefix of the word. `nil` if
#   it has none.
# @example
#   prefix?('mcdormer')           #=> 'mc'
Checks weither a word has a prefix as defined in
the MatchIndexs data and returns it.
Checks weither a word has a prefix as defined in the MatchIndexs data and returns it .
def prefix?(word)
      reindex if languages != NobleNames.configuration.languages
      prefixes.each do |pre|
        return pre unless (word =~ Regexp.new("^#{pre}")).nil?
      end
      nil
    end
def prefix? ( word ) reindex if languages != NobleNames . configuration . languages prefixes . each do | pre | return pre unless ( word =~ Regexp . new ( "^#{pre}" ) ) . nil? end nil end
Checks weither a word has a prefix as defined in
the MatchIndexs data and returns it.
Checks weither a word has a prefix as defined in the MatchIndexs data and returns it .
pre the Prefix of the word. `nil` if it has none.
pre the Prefix of the word . ` nil ` if it has none .
String
word
<not_specific>
<not_specific>
word the word that needs to be checked.
word the word that needs to be checked .
example
None