mirror of
https://github.com/heartcombo/devise.git
synced 2022-11-09 12:18:31 -05:00
Type cast ActiveSupport::Duration before compiling it.
This commit is contained in:
parent
cbb4796599
commit
c12651104b
1 changed files with 12 additions and 8 deletions
|
@ -60,15 +60,19 @@ module Devise
|
||||||
|
|
||||||
# Convert new keys to methods which overwrites Devise defaults
|
# Convert new keys to methods which overwrites Devise defaults
|
||||||
options.each do |key, value|
|
options.each do |key, value|
|
||||||
if value.is_a?(Proc)
|
case value
|
||||||
define_method key, &value
|
when Proc
|
||||||
else
|
define_method key, &value
|
||||||
class_eval <<-END_EVAL, __FILE__, __LINE__
|
next
|
||||||
def #{key}
|
when ActiveSupport::Duration
|
||||||
#{value.inspect}
|
value = value.to_i
|
||||||
end
|
|
||||||
END_EVAL
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
class_eval <<-END_EVAL, __FILE__, __LINE__
|
||||||
|
def #{key}
|
||||||
|
#{value.inspect}
|
||||||
|
end
|
||||||
|
END_EVAL
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue