File tree Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -126,7 +126,7 @@ def self.end_of_date(date, reference=Time.now)
126
126
# Convert a symbol to a numeric month
127
127
def self . sym_to_month ( sym )
128
128
MONTHS . fetch ( sym ) do |k |
129
- return wday = sym . to_i if MONTHS . values . any? { |i | i . to_s == sym . to_s }
129
+ MONTHS . values . detect { |i | i . to_s == k . to_s } or
130
130
raise ArgumentError , "Expecting Fixnum or Symbol value for month. " \
131
131
"No such month: #{ k . inspect } "
132
132
end
@@ -136,7 +136,7 @@ def self.sym_to_month(sym)
136
136
# Convert a symbol to a wday number
137
137
def self . sym_to_wday ( sym )
138
138
DAYS . fetch ( sym ) do |k |
139
- return sym . to_i if DAYS . values . any? { |i | i . to_s == sym . to_s }
139
+ DAYS . values . detect { |i | i . to_s == k . to_s } or
140
140
raise ArgumentError , "Expecting Fixnum or Symbol value for weekday. " \
141
141
"No such weekday: #{ k . inspect } "
142
142
end
You can’t perform that action at this time.
0 commit comments