Class: SimpleCaptcha::SimpleCaptchaData
- Inherits:
-
Object
- Object
- SimpleCaptcha::SimpleCaptchaData
- Includes:
- Mongoid::Document
- Defined in:
- lib/simple_captcha/simple_captcha_data.rb
Class Method Summary collapse
Class Method Details
.clear_old_data(time = 1.hour.ago) ⇒ Object
19 20 21 22 |
# File 'lib/simple_captcha/simple_captcha_data.rb', line 19 def clear_old_data(time = 1.hour.ago) return unless Time === time SimpleCaptchaData.where(:updated_at.lt => time.utc).delete_all end |
.get_data(key) ⇒ Object
10 11 12 |
# File 'lib/simple_captcha/simple_captcha_data.rb', line 10 def get_data(key) data = SimpleCaptchaData.where(:key => key).first || new(:key => key) end |
.remove_data(key) ⇒ Object
14 15 16 17 |
# File 'lib/simple_captcha/simple_captcha_data.rb', line 14 def remove_data(key) SimpleCaptchaData.where(:key => key).first.delete clear_old_data(1.hour.ago) end |