Sha256: 74c7f435459e473002a7faf3d36843405e59ea4c60508230f892179c03b0cfeb
Contents?: true
Size: 665 Bytes
Versions: 1
Compression:
Stored size: 665 Bytes
Contents
module SimpleCaptcha class SimpleCaptchaData include Mongoid::Document field :key, :type => String field :value, :type => String field :created_at, :type => Time, :default -> { Time.now } class << self def get_data(key) data = SimpleCaptchaData.where(:key => key).first || new(:key => key) end def remove_data(key) SimpleCaptchaData.where(:key => key).first.delete clear_old_data(1.hour.ago) end def clear_old_data(time = 1.hour.ago) return unless Time === time SimpleCaptchaData.where(:updated_at.lt => time).delete_all end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
wolcanus-simple_captcha-0.1.5 | lib/simple_captcha/simple_captcha_data.rb |