module Hizuke::DynamicPatternMatcher
def check_x_months_ago_pattern(text)
-
(Hizuke::Result, nil)
- the result or nil if no match
Parameters:
-
text
(String
) -- the text to check
def check_x_months_ago_pattern(text) if (match = text.match(X_MONTHS_AGO_PATTERN)) months = match[1].to_i date = Date.today << months clean_text = text.gsub(match[0], '').strip return Result.new(clean_text, date) end nil end