module Hizuke::DynamicPatternMatcher

def check_in_x_days_pattern(text)

Returns:
  • (Hizuke::Result, nil) - the result or nil if no match

Parameters:
  • text (String) -- the text to check
def check_in_x_days_pattern(text)
  if (match = text.match(IN_X_DAYS_PATTERN))
    days = match[1].to_i
    date = Date.today + days
    clean_text = text.gsub(match[0], '').strip
    return Result.new(clean_text, date)
  end
  nil
end