Method: Verbal#maybe

Defined in:
lib/verbal.rb

#maybe(value) ⇒ Object

Add a string to the expression that might appear once.

Examples:

Find http or https.

Verbal.new do
  find 'http'
  maybe 's'
end

Parameters:

  • value (String)

    the string to look for



89
90
91
# File 'lib/verbal.rb', line 89

def maybe(value)
  append "(?:#{sanitize value})?"
end