sapience 2.0.0 → 2.0.1
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 +38 -0
- data/lib/sapience/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6e1eed9b764d35ec28f0daacedfdb179dbe8d607
|
4
|
+
data.tar.gz: ef0e442123cb7aace075632ac747e0e24616115f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2d827e38c453a97c077a1a74d801c495711e2291727182dae7994e9b21e1e4a243a8f73432611d2adb4f6fd7fe0a0f8b24174ef579e9382fff8e8ed704d273d9
|
7
|
+
data.tar.gz: dbc55d9dd1bb0298f48c197cc3a5de419d0be0ff9638a0292d20a6b0f8ce386566e3926f24ba12e8cb3ef4172c41855f0236cb11132421ce636711c597e1c427
|
data/CHANGELOG.md
CHANGED
@@ -0,0 +1,38 @@
|
|
1
|
+
module Sapience
|
2
|
+
module Extensions
|
3
|
+
module ActiveRecord
|
4
|
+
module ModelMetrics
|
5
|
+
def self.included(base)
|
6
|
+
base.extend(ClassMethods)
|
7
|
+
base.class_eval do
|
8
|
+
const_set(:SAPIENCE_MODEL_CREATE_METRICS_KEY, "model.#{tableized_name}.create")
|
9
|
+
const_set(:SAPIENCE_MODEL_UPDATE_METRICS_KEY, "model.#{tableized_name}.update")
|
10
|
+
const_set(:SAPIENCE_MODEL_DESTROY_METRICS_KEY, "model.#{tableized_name}.destroy")
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
module ClassMethods
|
15
|
+
def tableized_name
|
16
|
+
@tableized_name ||= name.tableize.singularize.gsub("/", ".")
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
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
|
+
def tableized_name
|
33
|
+
self.class.tableized_name
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
data/lib/sapience/version.rb
CHANGED
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.
|
4
|
+
version: 2.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mikael Henriksson
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-10-
|
12
|
+
date: 2016-10-31 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: concurrent-ruby
|
@@ -327,6 +327,7 @@ files:
|
|
327
327
|
- lib/sapience/extensions/active_job/notifications.rb
|
328
328
|
- lib/sapience/extensions/active_model_serializers/logging.rb
|
329
329
|
- lib/sapience/extensions/active_record/log_subscriber.rb
|
330
|
+
- lib/sapience/extensions/active_record/model_metrics.rb
|
330
331
|
- lib/sapience/extensions/active_record/notifications.rb
|
331
332
|
- lib/sapience/extensions/grape/middleware/logging.rb
|
332
333
|
- lib/sapience/extensions/grape/notifications.rb
|