1
0
Fork 0
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:
José Valim 2009-10-20 13:02:24 -02:00
parent cbb4796599
commit c12651104b

View file

@ -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