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
|
||||
options.each do |key, value|
|
||||
if value.is_a?(Proc)
|
||||
define_method key, &value
|
||||
else
|
||||
class_eval <<-END_EVAL, __FILE__, __LINE__
|
||||
def #{key}
|
||||
#{value.inspect}
|
||||
end
|
||||
END_EVAL
|
||||
case value
|
||||
when Proc
|
||||
define_method key, &value
|
||||
next
|
||||
when ActiveSupport::Duration
|
||||
value = value.to_i
|
||||
end
|
||||
|
||||
class_eval <<-END_EVAL, __FILE__, __LINE__
|
||||
def #{key}
|
||||
#{value.inspect}
|
||||
end
|
||||
END_EVAL
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue