amazing_tap 0.1.0 → 0.1.1
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/CHANGELOG.md +4 -0
- data/README.md +72 -12
- data/lib/amazing_tap/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6821009d02bc4f54d723c0ea41341744e0d488d88e42ca944fc0efb231095937
|
|
4
|
+
data.tar.gz: 5d1acaa2975285161576e00a15f7f01720662afe83822011cc9013296c4b27b7
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 034defdbe3412e659b349cf92014a415f1e4668e2a32c06864df6749320fd8b00e6b164b2438cb61a5d839f5e7de716cab732c69e4d6506d041ab7a255fc73f1
|
|
7
|
+
data.tar.gz: a9bb676d9062c10690f9efa975d6926acde80a5439e98b876e418315e547218d24b1b69e26acf7c93f0b95ee3bf33ea4a6912570e140d0e21d6b04c7386f127a
|
data/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
## [Unreleased]
|
|
4
4
|
|
|
5
|
+
## [0.1.1] - 2026-08-08
|
|
6
|
+
|
|
7
|
+
- README overhaul: typed hash intro example with real output, per-option outputs in Usage, link to colorized terminal screenshot
|
|
8
|
+
|
|
5
9
|
## [0.1.0] - 2026-08-08
|
|
6
10
|
|
|
7
11
|
First release as `amazing_tap`, forked from [tap_amazing_print](https://github.com/shu0115/tap_amazing_print) 0.1.1.
|
data/README.md
CHANGED
|
@@ -2,6 +2,31 @@
|
|
|
2
2
|
|
|
3
3
|
Labeled, chain-safe debugging built on [amazing_print](https://github.com/amazing-print/amazing_print). `tapp` pretty-prints the receiver with a label inferred from the variable it was called on, plus its class and optional caller frames, then returns the receiver unchanged. Native `Object#tap` is not touched.
|
|
4
4
|
|
|
5
|
+
```ruby
|
|
6
|
+
require "amazing_tap"
|
|
7
|
+
|
|
8
|
+
user = {
|
|
9
|
+
id: 42,
|
|
10
|
+
name: "Ada Lovelace",
|
|
11
|
+
admin: true,
|
|
12
|
+
roles: [:owner, :editor]
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
user.tapp
|
|
16
|
+
# user (Hash)
|
|
17
|
+
# {
|
|
18
|
+
# id: 42,
|
|
19
|
+
# name: "Ada Lovelace",
|
|
20
|
+
# admin: true,
|
|
21
|
+
# roles: [
|
|
22
|
+
# [0] :owner,
|
|
23
|
+
# [1] :editor
|
|
24
|
+
# ]
|
|
25
|
+
# }
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Output is colorized in a terminal: [screenshot](https://github.com/dportalesr/amazing_tap/blob/main/.github/tapp-intro.png)
|
|
29
|
+
|
|
5
30
|
Fork of [shu0115/tap_amazing_print](https://github.com/shu0115/tap_amazing_print).
|
|
6
31
|
|
|
7
32
|
## Installation
|
|
@@ -19,23 +44,58 @@ gem install amazing_tap
|
|
|
19
44
|
|
|
20
45
|
## Usage
|
|
21
46
|
|
|
47
|
+
Examples below use:
|
|
48
|
+
|
|
22
49
|
```ruby
|
|
23
|
-
|
|
50
|
+
user = { id: 42, name: "Ada Lovelace" }
|
|
51
|
+
```
|
|
24
52
|
|
|
25
|
-
|
|
53
|
+
Chained receivers are inferred as written:
|
|
26
54
|
|
|
27
|
-
|
|
28
|
-
|
|
55
|
+
```ruby
|
|
56
|
+
account.owner.tapp
|
|
57
|
+
# account.owner (Hash)
|
|
29
58
|
# {
|
|
30
|
-
# :
|
|
31
|
-
# :
|
|
59
|
+
# id: 42,
|
|
60
|
+
# name: "Ada Lovelace"
|
|
32
61
|
# }
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Explicit label instead of inference:
|
|
65
|
+
|
|
66
|
+
```ruby
|
|
67
|
+
user.tapp(:after_update)
|
|
68
|
+
# after_update (Hash)
|
|
69
|
+
# { ... }
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Label without the class:
|
|
73
|
+
|
|
74
|
+
```ruby
|
|
75
|
+
user.tapp(type: false)
|
|
76
|
+
# user
|
|
77
|
+
# { ... }
|
|
78
|
+
```
|
|
33
79
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
user.tapp(backtrace: true)
|
|
38
|
-
user
|
|
80
|
+
Append the full caller as `from` lines:
|
|
81
|
+
|
|
82
|
+
```ruby
|
|
83
|
+
user.tapp(backtrace: true)
|
|
84
|
+
# user (Hash)
|
|
85
|
+
# { ... }
|
|
86
|
+
# from app/services/sync.rb:17:in 'Object#refresh'
|
|
87
|
+
# from app/services/sync.rb:19:in '<main>'
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Or only the first N frames:
|
|
91
|
+
|
|
92
|
+
```ruby
|
|
93
|
+
user.tapp(backtrace: 3)
|
|
94
|
+
# user (Hash)
|
|
95
|
+
# { ... }
|
|
96
|
+
# from app/services/sync.rb:22:in 'Object#persist'
|
|
97
|
+
# from app/services/sync.rb:26:in 'Object#sync'
|
|
98
|
+
# from app/services/sync.rb:28:in '<main>'
|
|
39
99
|
```
|
|
40
100
|
|
|
41
101
|
Label inference reads the receiver expression at the call site. It covers local variables, `@ivars`, `$globals`, dotted chains, and index access. When the source is not inferable (literals, parenthesized calls, multiline chains, REPL/eval), the header falls back to the class alone:
|
|
@@ -43,7 +103,7 @@ Label inference reads the receiver expression at the call site. It covers local
|
|
|
43
103
|
```ruby
|
|
44
104
|
{ a: 1 }.tapp
|
|
45
105
|
# (Hash)
|
|
46
|
-
# { :
|
|
106
|
+
# { a: 1 }
|
|
47
107
|
```
|
|
48
108
|
|
|
49
109
|
Long output gets a closing marker so you can tell where each dump ends:
|
data/lib/amazing_tap/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: amazing_tap
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Daniel Portales Rosado
|
|
@@ -76,7 +76,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
76
76
|
- !ruby/object:Gem::Version
|
|
77
77
|
version: '0'
|
|
78
78
|
requirements: []
|
|
79
|
-
rubygems_version:
|
|
79
|
+
rubygems_version: 4.0.18
|
|
80
80
|
specification_version: 4
|
|
81
81
|
summary: amazing_tap
|
|
82
82
|
test_files: []
|