File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -126,7 +126,7 @@ def self.end_of_date(date, reference=Time.now)
126126 # Convert a symbol to a numeric month
127127 def self . sym_to_month ( sym )
128128 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
130130 raise ArgumentError , "Expecting Fixnum or Symbol value for month. " \
131131 "No such month: #{ k . inspect } "
132132 end
@@ -136,7 +136,7 @@ def self.sym_to_month(sym)
136136 # Convert a symbol to a wday number
137137 def self . sym_to_wday ( sym )
138138 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
140140 raise ArgumentError , "Expecting Fixnum or Symbol value for weekday. " \
141141 "No such weekday: #{ k . inspect } "
142142 end
You can’t perform that action at this time.
0 commit comments