sapience 0.1.8 → 0.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4908b902460416cf75e0d35585a8e5fe05ca7122
4
- data.tar.gz: 9a891b42bb6cebad8ab1b4813ed16545098c2524
3
+ metadata.gz: 39e155af8dbe1159b4b409fed3f1c38d1aa88cf0
4
+ data.tar.gz: 4d49d889a237f8dbd67bf0cb1880387c24e1cb2f
5
5
  SHA512:
6
- metadata.gz: aaf091b3011036fab4b3397868320ed71ac4ea508b7848f6f1b889905f3d65695c3650f2bb467294060775fd81a717d8ad17b4d573f2ca52eab64aa94dab7adc
7
- data.tar.gz: 24993f2046efc7c305b07f0046236bae634768777358d7e0b29cd3f6acab01a77578632b31074ea0ce09c69585acb68a523b411a5c32aa8052ebfbac07f82808
6
+ metadata.gz: 0311c050dcf515ab0065b30bf238b06ecd6c9097d928267ed9577e383f027f1369297673a0659054cd378df07f455107bb45f8e7e4e8a45a3cfd1252b32dc384
7
+ data.tar.gz: caaad7563aa780619c6ec95ceb04da80b61804cec4317bc9d47cb3a4f9016cba3bfe36dbae102eb6ae965b5f53c2658af3f135aca1c88d13993286fd289fd2aa
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## v0.1.9
2
+
3
+ - Support sneakers timing implementation
4
+
1
5
  ## v0.1.8
2
6
 
3
7
  - Validate the sentry/raven dsn when creating the appender
@@ -64,8 +64,14 @@ module Sapience
64
64
  true
65
65
  end
66
66
 
67
- def timing(metric, duration)
68
- provider.timing(metric, duration)
67
+ def timing(metric, duration = 0)
68
+ if block_given?
69
+ start = Time.now
70
+ yield
71
+ provider.timing(metric, ((Time.now - start)*1000).floor)
72
+ else
73
+ provider.timing(metric, duration)
74
+ end
69
75
  end
70
76
 
71
77
  def increment(metric, amount = 1)
@@ -51,7 +51,8 @@ module Sapience
51
51
  def validate_options!(options = {})
52
52
  fail ArgumentError, "Options should be a Hash" unless options.is_a?(Hash)
53
53
  fail ArgumentError, "Options need to have the key :dsn" unless options.key?(:dsn)
54
- fail ArgumentError, "The :dsn key is not a valid URI" unless options[:dsn] =~ URI::DEFAULT_PARSER.regexp[:ABS_URI]
54
+ dsn_valid = options[:dsn] =~ URI::DEFAULT_PARSER.regexp[:ABS_URI]
55
+ fail ArgumentError, "The :dsn key is not a valid URI" unless dsn_valid
55
56
  end
56
57
 
57
58
  # Send an error notification to sentry
@@ -1,3 +1,3 @@
1
1
  module Sapience
2
- VERSION = "0.1.8"
2
+ VERSION = "0.1.9"
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: 0.1.8
4
+ version: 0.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mikael Henriksson