deprecation_collector 0.0.2 → 0.0.3

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
2
  SHA256:
3
- metadata.gz: 02cc02dc5d90e6b304ac5dadfc7ee09c1ac684ced0d3e0657095a47ffdc88e82
4
- data.tar.gz: ce2b0e299aed5c65f302ffb4fb72d49e7ea1f44772a5b6d61eeae1807eecb1fd
3
+ metadata.gz: 3585f079427d12b48286360dc9108a232190ca81d8ec71dd055c1306d34a226e
4
+ data.tar.gz: 02b556fb5ea800728f7bef7f4080da8d66bcc4d97e9a19ce1c034c88e7ec01cd
5
5
  SHA512:
6
- metadata.gz: b468f3a95e56ced60c3de42996f1d6c4d9249588dfe972c321aaf3dcf80f81cf9048dc040b14c9a604f7c01d780385de2ec4e3ea1cb5dbda47ac541bd20d1a83
7
- data.tar.gz: a245eb05033c494e514ba10e0ba63888bffb5e7fb86365a9e09cc425674be7c01df17d7c4870af60011c5a26600f07825e3a74971b5b690859762880f35b33e9
6
+ metadata.gz: 7240097b63afda5a65d127cbacc0547b76073f1a4861809c9c810fd191fca6f6d9d34bc865048bf062f2e9fc677ce8eae891b894f2c346e74dad49a2e83a9b3d
7
+ data.tar.gz: 7c6726e7d03cb2aef91c28f73184ac06e6ef57ccb0ab7a5dcf83b3d3780e924fd1cae231437e402cee3e490420d913f4409e420760e709a633a5c137e3038691
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- deprecation_collector (0.0.2)
4
+ deprecation_collector (0.0.3)
5
5
  redis (>= 2.0)
6
6
 
7
7
  GEM
@@ -123,7 +123,7 @@ GEM
123
123
  thor (>= 0.20.3, < 2.0)
124
124
  rainbow (3.1.1)
125
125
  rake (13.0.6)
126
- redis (4.6.0)
126
+ redis (4.7.1)
127
127
  regexp_parser (2.5.0)
128
128
  rexml (3.2.5)
129
129
  rspec (3.11.0)
data/README.md CHANGED
@@ -17,9 +17,9 @@ bundle add deprecation_collector
17
17
  Add an initializer with configuration, like
18
18
 
19
19
  ```ruby
20
- DeprecationCollector.create_instance(redis: your_redis_connection)
21
20
  Rails.application.config.to_prepare do
22
21
  DeprecationCollector.install do |instance|
22
+ instance.redis = Redis.new # default is $redis
23
23
  instance.app_revision = ::GIT_REVISION
24
24
  instance.count = false
25
25
  instance.save_full_backtrace = true
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class DeprecationCollector
4
- VERSION = "0.0.2"
4
+ VERSION = "0.0.3"
5
5
  end
@@ -5,6 +5,7 @@ require_relative "deprecation_collector/deprecation"
5
5
  require_relative "deprecation_collector/collectors"
6
6
  require "time"
7
7
  require "redis"
8
+ require "json"
8
9
 
9
10
  # singleton class for collector
10
11
  class DeprecationCollector
@@ -163,6 +164,10 @@ class DeprecationCollector
163
164
  @redis.set("deprecations:enabled", "false")
164
165
  end
165
166
 
167
+ def dump
168
+ read_each.to_a.to_json
169
+ end
170
+
166
171
  def read_each
167
172
  return to_enum(:read_each) unless block_given?
168
173
 
@@ -210,7 +215,7 @@ class DeprecationCollector
210
215
  cursor, data_pairs = @redis.hscan("deprecations:data", cursor) # NB: some pages may be empty
211
216
  total += data_pairs.size
212
217
  removed += delete_deprecations(
213
- data_pairs.select { |_digest, data| !block_given? || yield(JSON.parse(data, symbolize_names: true)) }.keys
218
+ data_pairs.to_h.select { |_digest, data| !block_given? || yield(JSON.parse(data, symbolize_names: true)) }.keys
214
219
  )
215
220
  break if cursor == "0"
216
221
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: deprecation_collector
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vasily Fedoseyev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-08-02 00:00:00.000000000 Z
11
+ date: 2022-08-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: redis