markdown_logging_proxy 1.1.1 → 1.2.0

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
  SHA256:
3
- metadata.gz: aff578739daa97caef0a7014bf062fe113a495cc124da496f6a08d8c31790e49
4
- data.tar.gz: 560c9efb88be9083d5d91b46a174c8b5c26c5c0b30289776c80f937b9ee81b1b
3
+ metadata.gz: 38a597efa8e2dab27f1fe61005c367d1cfbabd2e1ea5a03e03ec1b29d2baab02
4
+ data.tar.gz: f76c90d59eb9c1a911c6eeb2c3e1e2bb8ec881847d9bf8d9cadb0a53ae3378fc
5
5
  SHA512:
6
- metadata.gz: aa0ff0ff2637a3bd8eb9141cd6200e763478d071859958a07ca6585a2405fcce83160a9b03c49a88afa7f11428d3ed50bc4b3cde944bf96060c820b253406d20
7
- data.tar.gz: 45f2d7f82f0e7d366857b8da7ab7a6397e582190969155013facd87a5ae66c7c441f006486fee4cfe9b388538d614eaa60c533f478ec4a7165f9038031e31dcb
6
+ metadata.gz: 108a3acc43c38e7a9fad4773a5d2f2b7b9c55e33b1f6280869316affe6d8b48d342ada65cb170865f672a6f1a77f184a171ccdc6720ebe9c41d5bae8af5ed590
7
+ data.tar.gz: 9a696b09265a340d4934c4874cbe0e0977cd6739768d282f145255b128126cdac879e921de452addffa1b94b980dce0d7039d397babd978a179e70b70c09d5aa
data/CHANGELOG.md CHANGED
@@ -29,3 +29,7 @@
29
29
 
30
30
  - Allow proxying of `nil`
31
31
  - Add require statements to copy+paste version
32
+
33
+ ## [1.2.0]
34
+
35
+ - Overwrite as many `Object` methods as we can by default
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- markdown_logging_proxy (1.1.1)
4
+ markdown_logging_proxy (1.2.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -86,13 +86,8 @@ module MarkdownLoggingProxy
86
86
  end
87
87
  module MarkdownLoggingProxy
88
88
  class Proxy
89
- # Object methods that should be proxied but won't hit method_missing
90
- DEFAULT_OVERWRITES = %i[
91
- ! != !~ <=> == === =~
92
- clone display dup enum_for eql? equal? freeze frozen? hash inspect
93
- is_a? itself kind_of? nil? taint tainted? tap then to_enum to_s
94
- trust untaint unstrust untrusted? yield_self
95
- ]
89
+ DO_NOT_OVERWRITE = %i[__binding__ __id__ __send__ class extend]
90
+ DEFAULT_OVERWRITES = Object.new.methods - DO_NOT_OVERWRITE
96
91
 
97
92
  def initialize(
98
93
  to_proxy = nil,
@@ -205,16 +200,18 @@ module MarkdownLoggingProxy
205
200
 
206
201
  def log_and_proxy_block(meth, blk)
207
202
  return if blk.nil?
203
+ logger_ref = self.logger
204
+ target_ref = self.target
208
205
  proc do |*args|
209
- logger.log :info, 2, <<~MSG.chomp
210
- Yield to block in `#{meth}` on #{MarkdownLogger.id_object(target)}
206
+ logger_ref.log :info, 2, <<~MSG.chomp
207
+ Yield to block in `#{meth}` on #{MarkdownLogger.id_object(target_ref)}
211
208
 
212
209
  Arguments:
213
210
 
214
211
  #{MarkdownLogger.inspect_object(args, false)}
215
212
  MSG
216
- blk.call(*args).tap do |response|
217
- logger.log :info, 3, <<~MSG.chomp
213
+ instance_exec(*args, &blk).tap do |response|
214
+ logger_ref.log :info, 3, <<~MSG.chomp
218
215
  Response from block in `#{meth}`
219
216
 
220
217
  #{MarkdownLogger.inspect_object(response)}
@@ -1,12 +1,7 @@
1
1
  module MarkdownLoggingProxy
2
2
  class Proxy
3
- # Object methods that should be proxied but won't hit method_missing
4
- DEFAULT_OVERWRITES = %i[
5
- ! != !~ <=> == === =~
6
- clone display dup enum_for eql? equal? freeze frozen? hash inspect
7
- is_a? itself kind_of? nil? taint tainted? tap then to_enum to_s
8
- trust untaint unstrust untrusted? yield_self
9
- ]
3
+ DO_NOT_OVERWRITE = %i[__binding__ __id__ __send__ class extend]
4
+ DEFAULT_OVERWRITES = Object.new.methods - DO_NOT_OVERWRITE
10
5
 
11
6
  def initialize(
12
7
  to_proxy = nil,
@@ -75,16 +75,18 @@ module MarkdownLoggingProxy
75
75
 
76
76
  def log_and_proxy_block(meth, blk)
77
77
  return if blk.nil?
78
+ logger_ref = self.logger
79
+ target_ref = self.target
78
80
  proc do |*args|
79
- logger.log :info, 2, <<~MSG.chomp
80
- Yield to block in `#{meth}` on #{MarkdownLogger.id_object(target)}
81
+ logger_ref.log :info, 2, <<~MSG.chomp
82
+ Yield to block in `#{meth}` on #{MarkdownLogger.id_object(target_ref)}
81
83
 
82
84
  Arguments:
83
85
 
84
86
  #{MarkdownLogger.inspect_object(args, false)}
85
87
  MSG
86
- blk.call(*args).tap do |response|
87
- logger.log :info, 3, <<~MSG.chomp
88
+ instance_exec(*args, &blk).tap do |response|
89
+ logger_ref.log :info, 3, <<~MSG.chomp
88
90
  Response from block in `#{meth}`
89
91
 
90
92
  #{MarkdownLogger.inspect_object(response)}
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = "markdown_logging_proxy"
3
- spec.version = "1.1.1"
3
+ spec.version = "1.2.0"
4
4
  spec.authors = ["Carl Zulauf"]
5
5
  spec.email = ["carl@linkleaf.com"]
6
6
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: markdown_logging_proxy
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Carl Zulauf