deprecation 0.2.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: a2f81b6ac3b0ec0e588962e5c9b0314e7a8a3439
4
- data.tar.gz: b63ada54354a0804f77c468ade91442b5d82bb72
3
+ metadata.gz: 974299a00be061d7c77bea75662264bd90e84e88
4
+ data.tar.gz: 05b05522f673a5bc35aa022b62ea375c771a17b4
5
5
  SHA512:
6
- metadata.gz: a6b8a23cff2ad9efb77fcc4b5ec5d1b120239d2a3163108c97d5ae84241e668f9761253e034ceecc90aeffcb9842e831d477e8ec6b326da1feddfe6cc653086d
7
- data.tar.gz: 905c8692fa62dab1eaf683a42b288dab2246a615a258b80bfda4a273f22f97b5bead792f39ceea651ca026fe53fa917425029534f0c130f06ac7ab30970283c8
6
+ metadata.gz: 1defcbe01ed8c8a00b912284629e1442106000ad83d2617bb066025e53ee81d7713457e285aca39ec89c2bf8f623b425055484d21e98c97e022e8ef2c1d4a253
7
+ data.tar.gz: c24c5064090d8be010fd9411eaa5344f11bfe9cfa937842be1cb1b6388c0b4ac9ec54a4f6f16b3ddfa35123d26dc5461911f3cf8c90ea60b0d216ed5cfd6caad
@@ -18,7 +18,7 @@ module Deprecation
18
18
  end
19
19
 
20
20
  deprecation_message(callstack, message).tap do |m|
21
- deprecation_behavior(context).each { |b| b.call(m, callstack) }
21
+ deprecation_behavior(context).each { |b| b.call(m, sanitized_callstack(callstack)) }
22
22
  end
23
23
  end
24
24
 
@@ -92,8 +92,7 @@ module Deprecation
92
92
  end
93
93
 
94
94
  def extract_callstack(callstack)
95
- deprecation_gem_root = File.expand_path("../..", __FILE__) + "/"
96
- offending_line = callstack.find { |line| !line.start_with?(deprecation_gem_root) and line !~ IGNORE_REGEX } || callstack.first
95
+ offending_line = sanitized_callstack(callstack).first || callstack.first
97
96
  if offending_line
98
97
  if md = offending_line.match(/^(.+?):(\d+)(?::in `(.*?)')?/)
99
98
  md.captures
@@ -102,5 +101,13 @@ module Deprecation
102
101
  end
103
102
  end
104
103
  end
104
+
105
+ def sanitized_callstack(callstack)
106
+ callstack.reject { |line| line.start_with? deprecation_gem_root}.select { |line| (line =~ IGNORE_REGEX).nil? }
107
+ end
108
+
109
+ def deprecation_gem_root
110
+ File.expand_path("../..", __FILE__) + "/"
111
+ end
105
112
  end
106
113
  end
@@ -1,3 +1,3 @@
1
1
  module Deprecation
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
@@ -95,7 +95,7 @@ describe Deprecation do
95
95
  end
96
96
 
97
97
  it "should provide a useful deprecation trace" do
98
- logger.should_receive(:warn).with(/called from old_method/)
98
+ expect(logger).to receive(:warn).with(/called from old_method/)
99
99
  expect(A.new.old_method).to eq true
100
100
 
101
101
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: deprecation
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Beer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-19 00:00:00.000000000 Z
11
+ date: 2015-02-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport