after_do-logging 0.1.0 → 0.2.1

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: 7712a382fdbdb70b04e12525cf1c7aa0129e1b8c
4
- data.tar.gz: 65290a1bfcb4dccd4ec6a62125c6182b018f0c1c
3
+ metadata.gz: c8d051b7016ec975084334db4ac7f987e167126e
4
+ data.tar.gz: 73d4106606718c0e14fecd9e5e9c5acd631e9dcb
5
5
  SHA512:
6
- metadata.gz: 465e5ac985f7e23f5dcd9cc814e50febacf26aaa0f04322945936d04f0e952da3b3c88a7a5ebb1b44acc324b17d2e6f35b5684688ab0901995b1f333d5bdc917
7
- data.tar.gz: 54b0d56adeb5ddd0114a68b8bba11e99fdb267427bc7207b95ca1879f73928d458acee7e586a3635d1c2735e5bd44c22503d7aed98a33b6798b8ffea96f86654
6
+ metadata.gz: fe7d90cadf5a417cd8ab51fe63e2692914e08ae92153aef7ae27059347373587e57d86c21ee390c789be408f6ffa108d335d62e2db2c60c04cac0f60bca2c7f4
7
+ data.tar.gz: 2f129d695fbd4353c289bb42881add1e789c4d0e3085f7ea48f9c74a619bc52239fec15aa86b59f025d9b1ded2d58520ccb45a9185221b02bf030b940c4fde88
@@ -7,18 +7,18 @@ module AfterDo
7
7
  end
8
8
 
9
9
  def log_start(target_method)
10
- target_class.before target_method do |*args, _|
10
+ target_class.before target_method do |*args, object|
11
11
  method = "#{target_class}##{target_method}"
12
12
 
13
- log_step('Started', method, args)
13
+ log_step('Started', object, method, args)
14
14
  end
15
15
  end
16
16
 
17
17
  def log_finish(target_method)
18
- target_class.after target_method do |*args, _|
18
+ target_class.after target_method do |*args, object|
19
19
  method = "#{target_class}##{target_method}"
20
20
 
21
- log_step('Finished', method, args)
21
+ log_step('Finished', object, method, args)
22
22
  end
23
23
  end
24
24
 
@@ -28,11 +28,15 @@ module AfterDo
28
28
 
29
29
  private
30
30
 
31
- def log_step(prefix, method, args)
31
+ def log_step(prefix, object, method, args)
32
32
  arg_text = args.map(&:inspect).join(', ')
33
- msg = "#{prefix}: #{method}(#{arg_text})"
33
+ msg = "#{prefix}#{id(object)}: #{method}(#{arg_text})"
34
34
  logger.info(msg)
35
35
  end
36
+
37
+ def id(object)
38
+ "[#{object.id}]" if object.respond_to?(:id)
39
+ end
36
40
  end
37
41
  end
38
42
  end
@@ -1,5 +1,5 @@
1
1
  module AfterDo
2
2
  module Logging
3
- VERSION = '0.1.0'
3
+ VERSION = '0.2.1'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: after_do-logging
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rafael da Silva
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-09-09 00:00:00.000000000 Z
12
+ date: 2014-09-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: after_do