sapience 2.0.1 → 2.0.2

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
  SHA1:
3
- metadata.gz: 6e1eed9b764d35ec28f0daacedfdb179dbe8d607
4
- data.tar.gz: ef0e442123cb7aace075632ac747e0e24616115f
3
+ metadata.gz: eacddd2a363dd27232188e0576430593a3ea71de
4
+ data.tar.gz: 06160fc823fa373fa7a0367541c23a1d825e8e9c
5
5
  SHA512:
6
- metadata.gz: 2d827e38c453a97c077a1a74d801c495711e2291727182dae7994e9b21e1e4a243a8f73432611d2adb4f6fd7fe0a0f8b24174ef579e9382fff8e8ed704d273d9
7
- data.tar.gz: dbc55d9dd1bb0298f48c197cc3a5de419d0be0ff9638a0292d20a6b0f8ce386566e3926f24ba12e8cb3ef4172c41855f0236cb11132421ce636711c597e1c427
6
+ metadata.gz: c7a9eb74f28e568bd0646410098bbea506b438e0db276c959e37ec1eec753c4303f748a76a9119fbb1628c3a16a9cc7f0593f383108b757ddcbf17a69f80efe5
7
+ data.tar.gz: e44f3a521a0cff771a7f5598eee99f2f131dcbe7929e463f953787d78cbd629d532148202e4555f604dc3f82fd0e3ee4dd4e0a860f7c4f15f11eace2b17b6ce6
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## v2.0.2
2
+
3
+ - Fix metrics collection for 2.0.1
4
+
1
5
  ## v2.0.1
2
6
 
3
7
  - Add metrics for model actions (create, update, destroy)
@@ -2,12 +2,24 @@ module Sapience
2
2
  module Extensions
3
3
  module ActiveRecord
4
4
  module ModelMetrics
5
- def self.included(base)
5
+ def self.included(base) # rubocop:disable AbcSize
6
6
  base.extend(ClassMethods)
7
7
  base.class_eval do
8
8
  const_set(:SAPIENCE_MODEL_CREATE_METRICS_KEY, "model.#{tableized_name}.create")
9
9
  const_set(:SAPIENCE_MODEL_UPDATE_METRICS_KEY, "model.#{tableized_name}.update")
10
10
  const_set(:SAPIENCE_MODEL_DESTROY_METRICS_KEY, "model.#{tableized_name}.destroy")
11
+
12
+ before_create do
13
+ Sapience.metrics.increment(self.class.const_get(:SAPIENCE_MODEL_CREATE_METRICS_KEY))
14
+ end if respond_to?(:before_create)
15
+
16
+ before_update do
17
+ Sapience.metrics.increment(self.class.const_get(:SAPIENCE_MODEL_UPDATE_METRICS_KEY))
18
+ end if respond_to?(:before_update)
19
+
20
+ before_destroy do
21
+ Sapience.metrics.increment(self.class.const_get(:SAPIENCE_MODEL_DESTROY_METRICS_KEY))
22
+ end if respond_to?(:before_destroy)
11
23
  end
12
24
  end
13
25
 
@@ -17,18 +29,6 @@ module Sapience
17
29
  end
18
30
  end
19
31
 
20
- def before_create
21
- Sapience.metrics.increment(self.class.const_get(:SAPIENCE_MODEL_CREATE_METRICS_KEY))
22
- end
23
-
24
- def before_update
25
- Sapience.metrics.increment(self.class.const_get(:SAPIENCE_MODEL_UPDATE_METRICS_KEY))
26
- end
27
-
28
- def before_destroy
29
- Sapience.metrics.increment(self.class.const_get(:SAPIENCE_MODEL_DESTROY_METRICS_KEY))
30
- end
31
-
32
32
  def tableized_name
33
33
  self.class.tableized_name
34
34
  end
@@ -1,3 +1,3 @@
1
1
  module Sapience
2
- VERSION = "2.0.1"
2
+ VERSION = "2.0.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sapience
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.1
4
+ version: 2.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mikael Henriksson