binding_of_callers 0.1.8 → 0.2.2

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
- SHA1:
3
- metadata.gz: f4a26625d92d0ccc83102d381cf2b54697f33028
4
- data.tar.gz: 41e0b8fb029e92638af15598c5af79a7c525a516
2
+ SHA256:
3
+ metadata.gz: a6590a18ce85e8b2bd69972061c5a2c6f23b93344c686ca068200baf82a2fd66
4
+ data.tar.gz: ff0006a64f76f70a4c40852ebe3850346f60812480b1770591401cb16bbc37f7
5
5
  SHA512:
6
- metadata.gz: bd5069367fc7205be5b869c63cd759fa5320d3309abdc4f69c89785ff64bacb70a20085ac6ca0c0690a3d9f36373757f2682694298297e740783a173ab144726
7
- data.tar.gz: a6a24d2b7381ca2366ce0833d3b855c354fb277874c84679e04e72d42d306da6a1417f35204086dcf36544b3c2aa949aac34339d81d8ef4b89f1a81b91cfd9b6
6
+ metadata.gz: 4049585d6346140bc97623da6adff7bfb8b6c37725788b7abd578cd6244a5e5d56a53de9b7a269aefdebfd2f3bbaec77b3294a3efcbbb33f4c30121b0bc2109c
7
+ data.tar.gz: fa6bc3f4b2bdc389a73d122542b2ebe5b9541039cbea24bd89e0e2526a8b488b258f08e85968ec669ff3afe92d7c01e8fa17bb59f8575f7a9caa624148c2f2a5
data/.gitignore CHANGED
@@ -9,3 +9,4 @@
9
9
  /tmp/
10
10
  *.swp
11
11
  *.gem
12
+ .tool-versions
data/Gemfile CHANGED
@@ -1,4 +1,5 @@
1
1
  source 'https://rubygems.org'
2
+ # source 'https://gems.ruby-china.com'
2
3
 
3
4
  # Specify your gem's dependencies in binding_of_callers.gemspec
4
5
  gemspec
@@ -20,10 +20,10 @@ Gem::Specification.new do |spec|
20
20
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
21
21
  spec.require_paths = ["lib"]
22
22
 
23
- spec.add_development_dependency "bundler", "~> 1.13"
23
+ spec.add_development_dependency "bundler", "~> 2.0"
24
24
  spec.add_development_dependency "rake", "~> 10.0"
25
25
  spec.add_development_dependency "minitest", "~> 5.0"
26
26
 
27
- spec.add_dependency "binding_of_caller", "~> 0.7"
27
+ spec.add_dependency "binding_of_caller", "~> 1.0"
28
28
  spec.add_dependency "pry", ">= 0.10.0"
29
29
  end
@@ -1,3 +1,3 @@
1
1
  module BindingOfCallers
2
- VERSION = "0.1.8"
2
+ VERSION = "0.2.2"
3
3
  end
@@ -4,28 +4,34 @@ require 'binding_of_caller'
4
4
 
5
5
  class Binding
6
6
 
7
- def of_callers
8
- enhance do |bi|
7
+ def of_callers(fc = frame_count)
8
+ enhance(fc) do |bi|
9
9
  BindingOfCallers::Revealed.new bi
10
10
  end
11
11
  end
12
12
 
13
- def of_callers!
14
- enhance do |bi|
13
+ def of_callers!(fc = frame_count)
14
+ enhance(fc) do |bi|
15
15
  bi.extend BindingOfCallers::Reveal
16
16
  end
17
17
  end
18
18
 
19
+ def partial_callers(limit)
20
+ _callers = callers
21
+ limit = _callers.size + limit if limit < 0
22
+ _callers[1, limit].map!{ |c| BindingOfCallers::Revealed.new(c) }
23
+ end
24
+
19
25
  private
20
26
 
21
- def enhance &enhance
22
- collected.map(&enhance)
27
+ def enhance(fc, &enhance)
28
+ collected(fc).map(&enhance)
23
29
  end
24
30
 
25
- def collected
31
+ def collected(fc)
26
32
  n = 3
27
33
  bis = []
28
- while n < frame_count
34
+ while n < fc
29
35
  bis << of_caller(n)
30
36
  n = n.succ
31
37
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: binding_of_callers
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - ken
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-11-13 00:00:00.000000000 Z
11
+ date: 2022-05-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.13'
19
+ version: '2.0'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '1.13'
26
+ version: '2.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '0.7'
61
+ version: '1.0'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '0.7'
68
+ version: '1.0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: pry
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -121,8 +121,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
121
121
  - !ruby/object:Gem::Version
122
122
  version: '0'
123
123
  requirements: []
124
- rubyforge_project:
125
- rubygems_version: 2.6.8
124
+ rubygems_version: 3.1.6
126
125
  signing_key:
127
126
  specification_version: 4
128
127
  summary: a wrapper of binding_of_caller, for easy use