im-lost 1.2.1 → 1.2.2
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 +4 -4
- data/README.md +50 -52
- data/examples/foo.rb +50 -50
- data/lib/im-lost/version.rb +1 -1
- data/lib/im-lost.rb +32 -17
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6a11bb08b82dde3d4d56939a25d4898c77ef75ce9e82659511f8a47e6b1d0b9d
|
4
|
+
data.tar.gz: 073e42d29b09cd54db36a39d12e334d7cc2a5b9fbd5d2f3447265cd84cc278da
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eb4ee264f51b598b2b086033958a6eb587934a8d2be08c009f6c6d4c9991b84fd0657b5b691cdde7e50a2fb662316a81b6b38a5d7ada949277c14da99d12021a
|
7
|
+
data.tar.gz: 8b183a0464fb8a64a238792347ae697e557440b3cfc58bb26251f7b23ce2ef7ee766f2ca02fd0382ff449f3c17244c45dbfee494122bd6f28efd97f9e1b80e89
|
data/README.md
CHANGED
@@ -75,8 +75,6 @@ See the [online help](https://rubydoc.info/gems/im-lost/ImLost) for more!
|
|
75
75
|
```ruby
|
76
76
|
require 'im-lost'
|
77
77
|
|
78
|
-
require_relative '../lib/im-lost'
|
79
|
-
|
80
78
|
class Foo
|
81
79
|
def self.create(value:) = new(value)
|
82
80
|
|
@@ -109,56 +107,56 @@ my_foo.foo(3) { puts _1 }
|
|
109
107
|
ImLost.vars(my_foo)
|
110
108
|
|
111
109
|
# output will look like
|
112
|
-
#
|
113
|
-
#
|
114
|
-
#
|
115
|
-
#
|
116
|
-
#
|
117
|
-
#
|
118
|
-
#
|
119
|
-
#
|
120
|
-
#
|
121
|
-
#
|
122
|
-
#
|
123
|
-
#
|
124
|
-
#
|
125
|
-
#
|
126
|
-
#
|
127
|
-
#
|
128
|
-
#
|
129
|
-
#
|
130
|
-
#
|
131
|
-
#
|
132
|
-
#
|
133
|
-
#
|
134
|
-
#
|
135
|
-
#
|
136
|
-
#
|
137
|
-
#
|
138
|
-
#
|
139
|
-
#
|
140
|
-
#
|
141
|
-
#
|
142
|
-
#
|
143
|
-
#
|
144
|
-
#
|
145
|
-
#
|
146
|
-
#
|
147
|
-
#
|
148
|
-
#
|
149
|
-
#
|
150
|
-
#
|
151
|
-
#
|
152
|
-
#
|
153
|
-
#
|
154
|
-
#
|
155
|
-
#
|
156
|
-
#
|
157
|
-
#
|
158
|
-
#
|
159
|
-
#
|
160
|
-
#
|
161
|
-
#
|
110
|
+
# > Foo.create(:foo!)
|
111
|
+
# ./examples/foo.rb:24
|
112
|
+
# > Foo.new(*args)
|
113
|
+
# ./examples/foo.rb:6
|
114
|
+
# < Foo.new(*args)
|
115
|
+
# ./examples/foo.rb:6
|
116
|
+
# = #<Foo:0x0000000104c24b88 @value=:foo!>
|
117
|
+
# < Foo.create(:foo!)
|
118
|
+
# ./examples/foo.rb:24
|
119
|
+
# = #<Foo:0x0000000104c24b88 @value=:foo!>
|
120
|
+
# > Foo#foo(1, *[], :none, **{}, &nil)
|
121
|
+
# ./examples/foo.rb:27
|
122
|
+
# > Foo#bar()
|
123
|
+
# ./examples/foo.rb:15
|
124
|
+
# < Foo#bar()
|
125
|
+
# ./examples/foo.rb:15
|
126
|
+
# = :bar
|
127
|
+
# < Foo#foo(1, *[], :none, **{}, &nil)
|
128
|
+
# ./examples/foo.rb:27
|
129
|
+
# = "1-none-[]-{}-bar"
|
130
|
+
# * ./examples/foo.rb:28
|
131
|
+
# > instance variables
|
132
|
+
# @value: "1-none-[]-{}-bar"
|
133
|
+
# > Foo#foo(2, *[:a, :b, :c], :some, **{name: :value}, &nil)
|
134
|
+
# ./examples/foo.rb:30
|
135
|
+
# > Foo#bar()
|
136
|
+
# ./examples/foo.rb:15
|
137
|
+
# < Foo#bar()
|
138
|
+
# ./examples/foo.rb:15
|
139
|
+
# = :bar
|
140
|
+
# < Foo#foo(2, *[:a, :b, :c], :some, **{name: :value}, &nil)
|
141
|
+
# ./examples/foo.rb:30
|
142
|
+
# = "2-some-[a,b,c]-{name: :value}-bar"
|
143
|
+
# * ./examples/foo.rb:31
|
144
|
+
# > instance variables
|
145
|
+
# @value: "2-some-[a,b,c]-{name: :value}-bar"
|
146
|
+
# > Foo#foo(3, *[], nil, **{}, &#<Proc:0x0000000104c22180 ./examples/foo.rb:33>)
|
147
|
+
# ./examples/foo.rb:33
|
148
|
+
# > Foo#bar()
|
149
|
+
# ./examples/foo.rb:15
|
150
|
+
# < Foo#bar()
|
151
|
+
# ./examples/foo.rb:15
|
152
|
+
# = :bar
|
153
|
+
# 3--[]-{}-bar
|
154
|
+
# < Foo#foo(3, *[], nil, **{}, &#<Proc:0x0000000104c22180 ./examples/foo.rb:33>)
|
155
|
+
# ./examples/foo.rb:33
|
156
|
+
# = nil
|
157
|
+
# * ./examples/foo.rb:34
|
158
|
+
# > instance variables
|
159
|
+
# @value: "3--[]-{}-bar"
|
162
160
|
```
|
163
161
|
|
164
162
|
See [examples dir](./examples) for more…
|
data/examples/foo.rb
CHANGED
@@ -34,53 +34,53 @@ my_foo.foo(3) { puts _1 }
|
|
34
34
|
ImLost.vars(my_foo)
|
35
35
|
|
36
36
|
# output will look like
|
37
|
-
#
|
38
|
-
#
|
39
|
-
#
|
40
|
-
#
|
41
|
-
#
|
42
|
-
#
|
43
|
-
#
|
44
|
-
#
|
45
|
-
#
|
46
|
-
#
|
47
|
-
#
|
48
|
-
#
|
49
|
-
#
|
50
|
-
#
|
51
|
-
#
|
52
|
-
#
|
53
|
-
#
|
54
|
-
#
|
55
|
-
#
|
56
|
-
#
|
57
|
-
#
|
58
|
-
#
|
59
|
-
#
|
60
|
-
#
|
61
|
-
#
|
62
|
-
#
|
63
|
-
#
|
64
|
-
#
|
65
|
-
#
|
66
|
-
#
|
67
|
-
#
|
68
|
-
#
|
69
|
-
#
|
70
|
-
#
|
71
|
-
#
|
72
|
-
#
|
73
|
-
#
|
74
|
-
#
|
75
|
-
#
|
76
|
-
#
|
77
|
-
#
|
78
|
-
#
|
79
|
-
#
|
80
|
-
#
|
81
|
-
#
|
82
|
-
#
|
83
|
-
#
|
84
|
-
#
|
85
|
-
#
|
86
|
-
#
|
37
|
+
# > Foo.create(:foo!)
|
38
|
+
# ./examples/foo.rb:24
|
39
|
+
# > Foo.new(*args)
|
40
|
+
# ./examples/foo.rb:6
|
41
|
+
# < Foo.new(*args)
|
42
|
+
# ./examples/foo.rb:6
|
43
|
+
# = #<Foo:0x0000000104c24b88 @value=:foo!>
|
44
|
+
# < Foo.create(:foo!)
|
45
|
+
# ./examples/foo.rb:24
|
46
|
+
# = #<Foo:0x0000000104c24b88 @value=:foo!>
|
47
|
+
# > Foo#foo(1, *[], :none, **{}, &nil)
|
48
|
+
# ./examples/foo.rb:27
|
49
|
+
# > Foo#bar()
|
50
|
+
# ./examples/foo.rb:15
|
51
|
+
# < Foo#bar()
|
52
|
+
# ./examples/foo.rb:15
|
53
|
+
# = :bar
|
54
|
+
# < Foo#foo(1, *[], :none, **{}, &nil)
|
55
|
+
# ./examples/foo.rb:27
|
56
|
+
# = "1-none-[]-{}-bar"
|
57
|
+
# * ./examples/foo.rb:28
|
58
|
+
# > instance variables
|
59
|
+
# @value: "1-none-[]-{}-bar"
|
60
|
+
# > Foo#foo(2, *[:a, :b, :c], :some, **{name: :value}, &nil)
|
61
|
+
# ./examples/foo.rb:30
|
62
|
+
# > Foo#bar()
|
63
|
+
# ./examples/foo.rb:15
|
64
|
+
# < Foo#bar()
|
65
|
+
# ./examples/foo.rb:15
|
66
|
+
# = :bar
|
67
|
+
# < Foo#foo(2, *[:a, :b, :c], :some, **{name: :value}, &nil)
|
68
|
+
# ./examples/foo.rb:30
|
69
|
+
# = "2-some-[a,b,c]-{name: :value}-bar"
|
70
|
+
# * ./examples/foo.rb:31
|
71
|
+
# > instance variables
|
72
|
+
# @value: "2-some-[a,b,c]-{name: :value}-bar"
|
73
|
+
# > Foo#foo(3, *[], nil, **{}, &#<Proc:0x0000000104c22180 ./examples/foo.rb:33>)
|
74
|
+
# ./examples/foo.rb:33
|
75
|
+
# > Foo#bar()
|
76
|
+
# ./examples/foo.rb:15
|
77
|
+
# < Foo#bar()
|
78
|
+
# ./examples/foo.rb:15
|
79
|
+
# = :bar
|
80
|
+
# 3--[]-{}-bar
|
81
|
+
# < Foo#foo(3, *[], nil, **{}, &#<Proc:0x0000000104c22180 ./examples/foo.rb:33>)
|
82
|
+
# ./examples/foo.rb:33
|
83
|
+
# = nil
|
84
|
+
# * ./examples/foo.rb:34
|
85
|
+
# > instance variables
|
86
|
+
# @value: "3--[]-{}-bar"
|
data/lib/im-lost/version.rb
CHANGED
data/lib/im-lost.rb
CHANGED
@@ -54,7 +54,7 @@ module ImLost
|
|
54
54
|
return @output = value if defined?(value.<<)
|
55
55
|
raise(
|
56
56
|
NoMethodError,
|
57
|
-
"undefined method '
|
57
|
+
"undefined method '#<<' for an instance of #{
|
58
58
|
Kernel.instance_method(:class).bind(value).call
|
59
59
|
}"
|
60
60
|
)
|
@@ -107,14 +107,16 @@ module ImLost
|
|
107
107
|
#
|
108
108
|
def trace_exceptions(with_locations: true)
|
109
109
|
return unless block_given?
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
110
|
+
begin
|
111
|
+
we = @trace_exceptions.enabled?
|
112
|
+
el = @exception_locations
|
113
|
+
@exception_locations = with_locations
|
114
|
+
@trace_exceptions.enable unless we
|
115
|
+
yield
|
116
|
+
ensure
|
117
|
+
@trace_exceptions.disable unless we
|
118
|
+
@exception_locations = el
|
119
|
+
end
|
118
120
|
end
|
119
121
|
|
120
122
|
#
|
@@ -314,7 +316,7 @@ module ImLost
|
|
314
316
|
object
|
315
317
|
ensure
|
316
318
|
@trace[traced] = traced if traced
|
317
|
-
@output << out
|
319
|
+
@output << out
|
318
320
|
end
|
319
321
|
|
320
322
|
private
|
@@ -380,8 +382,8 @@ module ImLost
|
|
380
382
|
end
|
381
383
|
|
382
384
|
def _instance_vars(out, object)
|
383
|
-
out.vars('instance variables', object.instance_variables) do |
|
384
|
-
object.instance_variable_get(
|
385
|
+
out.vars('instance variables', object.instance_variables) do |name|
|
386
|
+
object.instance_variable_get(name)
|
385
387
|
end
|
386
388
|
object
|
387
389
|
end
|
@@ -454,7 +456,11 @@ module ImLost
|
|
454
456
|
|
455
457
|
# @attribute [r] ids
|
456
458
|
# @return [Array<Integer>] IDs of all registered timers
|
457
|
-
def ids =
|
459
|
+
def ids = @ll.keys.keep_if { Integer === _1 }
|
460
|
+
|
461
|
+
# @attribute [r] names
|
462
|
+
# @return [Array<String>] names of all registered named timers
|
463
|
+
def names = @ll.keys.delete_if { Integer === _1 }
|
458
464
|
|
459
465
|
#
|
460
466
|
# Create and register a new named or anonymous timer.
|
@@ -491,6 +497,16 @@ module ImLost
|
|
491
497
|
nil
|
492
498
|
end
|
493
499
|
|
500
|
+
#
|
501
|
+
# Delete and unregister all timers.
|
502
|
+
#
|
503
|
+
# @return [self] itself
|
504
|
+
#
|
505
|
+
def clear
|
506
|
+
@ll = {}
|
507
|
+
self
|
508
|
+
end
|
509
|
+
|
494
510
|
#
|
495
511
|
# Print the ID or name and the runtime since a timer was created.
|
496
512
|
# It includes the location.
|
@@ -525,7 +541,7 @@ module ImLost
|
|
525
541
|
|
526
542
|
def initialize(&block)
|
527
543
|
@cb = block
|
528
|
-
|
544
|
+
clear
|
529
545
|
end
|
530
546
|
end
|
531
547
|
|
@@ -643,10 +659,9 @@ module ImLost
|
|
643
659
|
TIMER_MSG
|
644
660
|
TimerStore.private_class_method(:new)
|
645
661
|
|
646
|
-
|
647
|
-
|
662
|
+
untrace_all!
|
648
663
|
@output = STDERR
|
649
|
-
@
|
664
|
+
@fiber_support = !!defined?(Fiber.current.storage)
|
650
665
|
@caller_locations = @exception_locations = true
|
651
666
|
self.trace_calls = self.trace_results = true
|
652
667
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: im-lost
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Blumtritt
|
8
8
|
bindir: bin
|
9
9
|
cert_chain: []
|
10
|
-
date:
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
11
11
|
dependencies: []
|
12
12
|
description: |
|
13
13
|
If you have overlooked something again and don't really understand what
|
@@ -21,8 +21,8 @@ description: |
|
|
21
21
|
executables: []
|
22
22
|
extensions: []
|
23
23
|
extra_rdoc_files:
|
24
|
-
- README.md
|
25
24
|
- LICENSE
|
25
|
+
- README.md
|
26
26
|
files:
|
27
27
|
- LICENSE
|
28
28
|
- README.md
|
@@ -54,7 +54,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
54
54
|
- !ruby/object:Gem::Version
|
55
55
|
version: '0'
|
56
56
|
requirements: []
|
57
|
-
rubygems_version: 3.6.
|
57
|
+
rubygems_version: 3.6.8
|
58
58
|
specification_version: 4
|
59
59
|
summary: Your debugging helper.
|
60
60
|
test_files: []
|