glebtv-simple_captcha 0.7.0 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 90553fb317ba281b2d5c68519296718fcdca88f5
4
- data.tar.gz: 2cc1421e91ec023153cd7554e63842a1498d1909
2
+ SHA256:
3
+ metadata.gz: 653ac01fb6ddf71a0e4eceea878986e35de35b4e67fc65951e8d3ef8b38e712b
4
+ data.tar.gz: 82b3121008ea69c1bbf490da5381945999fcda04904b3fdcbb50eaa45101d284
5
5
  SHA512:
6
- metadata.gz: 5bc581103a08ca15d0d3990eaeccfae46a605b1d95fd1cb7d2683851f67a4921c57e8d982c099934fc8a649c0e981c43431725b6b390a52bdb23a1d0c10b7a8f
7
- data.tar.gz: 77f587eed8ab1beb33e68c4f8cd7e06fb0af61e4733ee224d902f912677cdcc5dec75788453ded0de50de629e194eb57153a980fb703942c209de7ff8ecaaf93
6
+ metadata.gz: 29befa7e753674306bff80506f6ce57f94048c1a1b94b55d4ccdc175852c41657b9ee654245357e02c3bbe57d105b584664830ec48e4e07b9e2ee6d31a3d1569
7
+ data.tar.gz: 0a92dd62e37a82bb749a75d34e48564d2538ef4b16d431f6e2315978f4bf7470b81ac335fc3d16382ceb9f5db347e74a7a7f7221d93df4b31735fd1c4e7f1038
@@ -8,14 +8,14 @@ module SimpleCaptcha
8
8
  end
9
9
 
10
10
  def remove_data(key)
11
- delete_all(["#{connection.quote_column_name(:key)} = ?", key])
11
+ where("#{connection.quote_column_name(:key)} = ?", key).delete_all
12
12
  clear_old_data(1.hour.ago)
13
13
  end
14
14
 
15
15
  def clear_old_data(time = 1.hour.ago)
16
16
  return unless Time === time
17
- delete_all(["#{connection.quote_column_name(:updated_at)} < ?", time])
17
+ where("#{connection.quote_column_name(:updated_at)} < ?", time).delete_all
18
18
  end
19
19
  end
20
20
  end
21
- end
21
+ end
@@ -2,22 +2,22 @@ module SimpleCaptcha
2
2
  class SimpleCaptchaData
3
3
  include Mongoid::Document
4
4
  include Mongoid::Timestamps
5
-
5
+
6
6
  store_in collection: "simple_captcha_data"
7
-
7
+
8
8
  field :key, :type => String
9
9
  field :value, :type => String
10
-
10
+
11
11
  class << self
12
12
  def get_data(key)
13
13
  SimpleCaptchaData.where(:key => key).first || new(:key => key)
14
14
  end
15
-
15
+
16
16
  def remove_data(key)
17
17
  SimpleCaptchaData.where(:key => key).first.delete
18
18
  clear_old_data(1.hour.ago)
19
19
  end
20
-
20
+
21
21
  def clear_old_data(time = 1.hour.ago)
22
22
  return unless Time === time
23
23
  SimpleCaptchaData.where(:updated_at.lt => time.utc).delete_all
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  module SimpleCaptcha
4
- VERSION = "0.7.0".freeze
4
+ VERSION = "0.8.0".freeze
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: glebtv-simple_captcha
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - GlebTv
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-04-19 00:00:00.000000000 Z
11
+ date: 2018-05-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -99,7 +99,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
99
99
  version: '0'
100
100
  requirements: []
101
101
  rubyforge_project:
102
- rubygems_version: 2.6.11
102
+ rubygems_version: 2.7.7
103
103
  signing_key:
104
104
  specification_version: 4
105
105
  summary: A fork of a fork of a fork of simple_captcha.