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 +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/sapience/extensions/active_record/model_metrics.rb +13 -13
- data/lib/sapience/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eacddd2a363dd27232188e0576430593a3ea71de
|
4
|
+
data.tar.gz: 06160fc823fa373fa7a0367541c23a1d825e8e9c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c7a9eb74f28e568bd0646410098bbea506b438e0db276c959e37ec1eec753c4303f748a76a9119fbb1628c3a16a9cc7f0593f383108b757ddcbf17a69f80efe5
|
7
|
+
data.tar.gz: e44f3a521a0cff771a7f5598eee99f2f131dcbe7929e463f953787d78cbd629d532148202e4555f604dc3f82fd0e3ee4dd4e0a860f7c4f15f11eace2b17b6ce6
|
data/CHANGELOG.md
CHANGED
@@ -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
|
data/lib/sapience/version.rb
CHANGED