module Net::IMAP::StringPrep
def check_prohibited!(string,
+profile+ is an optional string which will be added to any exception that
raise a BidiStringError.
Also checks bidirectional characters, when bidi: true, which may
ProhibitedCodepoint describing the first matching table.
Checks +string+ for any codepoint in +tables+. Raises a
def check_prohibited!(string, *tables, bidi: false, unassigned: "A.1", stored: false, profile: nil) tables = Tables::TITLES.keys.grep(/^C/) if tables.empty? tables |= [unassigned] if stored tables |= %w[C.8] if bidi table = tables.find {|t| case t when String then Tables::REGEXPS.fetch(t).match?(string) when Regexp then t.match?(string) else raise ArgumentError, "only table names and regexps can be checked" end } if table raise ProhibitedCodepoint.new( table, string: string, profile: profile ) end check_bidi!(string, profile: profile) if bidi end