27
28
29
30
31
32
33
34
35
36
37
38
39
|
# File 'lib/what_date/date_of_month.rb', line 27
def method_missing(name, *args, &block)
methods = missing_method_reg.match(name)
if methods
order = ORDINALS[methods[1].downcase]
day = format_date_string methods[2]
month = format_date_string methods[3]
year = methods[4] ? methods[4][/\d+/].to_i : Date.today.year
order == nil ? date_of_last_week_day_in_month(day, month, year) :
date_of_month(order: order, day: day, month: month, year: year)
else
super
end
end
|