module SimplePeriod::Format

Constants

DAY_REGEX
HOUR_REGEX
MIN_REGEX
MONTH_REGEX
PROC_REGEX
WEEK_REGEX
YEAR_REGEX

Public Class Methods

method_missing(name) click to toggle source
Calls superclass method
# File lib/simple_period/format.rb, line 15
def method_missing(name)
  return super if name !~ PROC_REGEX

  match_data = name.match(PROC_REGEX)
  const_name = match_data.pre_match.upcase
  regex = const_get("#{const_name}_REGEX", false)
  lambda { |txt| txt =~ regex }
end