puts_debuggerer 0.8.2 → 0.11.0
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 +87 -0
- data/LICENSE.txt +1 -1
- data/README.md +429 -66
- data/VERSION +1 -1
- data/lib/pd.rb +1 -0
- data/lib/puts_debuggerer.rb +157 -278
- data/lib/puts_debuggerer/core_ext/kernel.rb +224 -0
- data/lib/puts_debuggerer/core_ext/logger.rb +3 -0
- data/lib/puts_debuggerer/core_ext/logging/logger.rb +5 -0
- data/lib/puts_debuggerer/run_determiner.rb +109 -0
- data/lib/puts_debuggerer/source_file.rb +32 -0
- metadata +39 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 43ff23befa76e5fc66ff64e550594c4e0c4a2055d586329ee731c075c6ab54a7
|
4
|
+
data.tar.gz: 1224fadbcca6b036eac9ed58d9ce60d5e7f7a6cd3a6742de05e4f82cb9107b8e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 13af30103a2bfa13e3e579f9083ed366fb4fa168e53a7c685e9181c60fb194dc24430e49d14348d4ae59f7573430b1f665987182b101a4a5da28394acf9b485e
|
7
|
+
data.tar.gz: 3b6eb47ca8c5758f3ffe6405ca94031bc05ee2cfad09cbb1f20fec85aea0fef42c0900a9ccd43916f4f567aed1d7c8f5ec9ec779c69c586cd9f5052e8b809047
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,87 @@
|
|
1
|
+
# Change Log
|
2
|
+
|
3
|
+
## 0.11.0
|
4
|
+
|
5
|
+
- Pry support
|
6
|
+
- In Opal, print exceptions as errors in the web console using an alternative to full_message since it's not implemented in Opal yet
|
7
|
+
- Fix `pd_inspect` and `pdi` in IRB
|
8
|
+
|
9
|
+
## 0.10.2
|
10
|
+
|
11
|
+
- Improve Opal Ruby compatibility by displaying source file/line
|
12
|
+
|
13
|
+
## 0.10.1
|
14
|
+
|
15
|
+
- Remove the need for specifying `require 'ap'` before `require 'pd'`
|
16
|
+
|
17
|
+
## 0.10.0
|
18
|
+
|
19
|
+
- Support `require 'pd`' as a shorter alternative to `require 'puts_debuggerer'`
|
20
|
+
- Support `printer` as a Logger object or Logging::Logger (from "logging" gem). Basically any object that responds to :debug method.
|
21
|
+
- Support `printer: false` option to return rendered String instead of printing and returning object
|
22
|
+
- Set logger formatter to PutsDebuggerer::LOGGER_FORMATTER_DECORATOR when passing as printer (keeping format the same, but decorating msg with pd)
|
23
|
+
- Add pd_inspect (and pdi alias) Kernel core extension methods
|
24
|
+
- Made awesome_print gem require happen only if printer is set to :ap or :awesome_print
|
25
|
+
- Support logging gem logger and Decorate logger layout with PutsDebuggerer::LOGGING_LAYOUT_DECORATOR for logging gem
|
26
|
+
|
27
|
+
## 0.9.0
|
28
|
+
|
29
|
+
- Provide partial support for Opal Ruby (missing display of file name, line number, and source code)
|
30
|
+
- `source_line_count` option
|
31
|
+
- `wraper` option for including both `header` and `footer`
|
32
|
+
- Special handling of exceptions (prints using full_message)
|
33
|
+
- Change :ap printer default to :p when unavailable
|
34
|
+
- Support varargs printing (example: `pd arg1, arg2, arg3`)
|
35
|
+
- Display `run_at` run number in printout
|
36
|
+
|
37
|
+
## 0.8.2
|
38
|
+
|
39
|
+
- require 'stringio' for projects that don't require automatically via other gems
|
40
|
+
|
41
|
+
## 0.8.1
|
42
|
+
|
43
|
+
- `printer` option support for Rails test environment
|
44
|
+
|
45
|
+
## 0.8.0
|
46
|
+
|
47
|
+
- `printer` option support
|
48
|
+
|
49
|
+
## 0.7.1
|
50
|
+
|
51
|
+
- default print engine to :ap (AwesomePrint)
|
52
|
+
|
53
|
+
## 0.7.0
|
54
|
+
|
55
|
+
- `run_at` option, global and piecemeal.
|
56
|
+
|
57
|
+
## 0.6.1
|
58
|
+
|
59
|
+
- updated README and broke apart specs
|
60
|
+
|
61
|
+
## 0.6.0
|
62
|
+
|
63
|
+
- unofficial erb support, returning evaluated object/expression, removed static syntax support (replaced with header support)
|
64
|
+
|
65
|
+
## 0.5.1
|
66
|
+
|
67
|
+
- support for print engine lambdas and smart defaults for leveraging Rails and AwesomePrint debuggers in Rails
|
68
|
+
|
69
|
+
## 0.5.0
|
70
|
+
|
71
|
+
- custom formatter, caller backtrace, per-puts piecemeal options, and multi-line support
|
72
|
+
|
73
|
+
## 0.4.0
|
74
|
+
|
75
|
+
- custom print engine (e.g. ap), custom announcer, and IRB support
|
76
|
+
|
77
|
+
## 0.3.0
|
78
|
+
|
79
|
+
- header/footer support, multi-line printout, improved format
|
80
|
+
|
81
|
+
## 0.2.0
|
82
|
+
|
83
|
+
- App path exclusion support, Rails root support, improved format
|
84
|
+
|
85
|
+
## 0.1.0
|
86
|
+
|
87
|
+
- File/line/expression print out
|
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -2,16 +2,23 @@
|
|
2
2
|
[](http://badge.fury.io/rb/puts_debuggerer)
|
3
3
|
[](https://travis-ci.org/AndyObtiva/puts_debuggerer)
|
4
4
|
[](https://coveralls.io/github/AndyObtiva/puts_debuggerer?branch=master)
|
5
|
+
[](https://codeclimate.com/github/AndyObtiva/puts_debuggerer/maintainability)
|
6
|
+
|
7
|
+
(credit to Aaron Patterson for partial inspiration: https://tenderlovemaking.com/2016/02/05/i-am-a-puts-debuggerer.html)
|
5
8
|
|
6
9
|
Debuggers are great! They help us troubleshoot complicated programming problems by inspecting values produced by code, line by line. They are invaluable when trying to understand what is going on in a large application composed of thousands or millions of lines of code.
|
7
10
|
|
8
|
-
In day-to-day test-driven development and simple debugging though, a puts statement can be a lot quicker in revealing what is going on than halting execution completely just to inspect a single value or a few. This is certainly true when writing the simplest possible code that could possibly work, and running a test every few seconds or minutes.
|
11
|
+
In day-to-day test-driven development and simple app debugging though, a puts statement can be a lot quicker in revealing what is going on than halting execution completely just to inspect a single value or a few. This is certainly true when writing the simplest possible code that could possibly work, and running a test every few seconds or minutes. Still, there are a number of problems with puts debugging, like difficulty in locating puts statements in a large output log, knowing which methods and line numbers were invoked, identifying which variables were printed, and seeing the content of structured hashes and arrays in an understandable format.
|
12
|
+
|
13
|
+
Enter [puts_debuggerer](https://rubygems.org/gems/puts_debuggerer)! A guilt-free puts debugging Ruby gem FTW that prints file names, line numbers, code statements, headers, footers, stack traces, and formats output nicely courtesy of [awesome_print](https://rubygems.org/gems/awesome_print).
|
14
|
+
|
15
|
+
[puts_debuggerer](https://rubygems.org/gems/puts_debuggerer) automates tips mentioned in [this blog post](https://tenderlovemaking.com/2016/02/05/i-am-a-puts-debuggerer.html) by Aaron Patterson using the `pd` method available everywhere after requiring the [gem](https://rubygems.org/gems/puts_debuggerer).
|
9
16
|
|
10
17
|
Basic Example:
|
11
18
|
|
12
19
|
```ruby
|
13
20
|
# /Users/User/trivia_app.rb # line 1
|
14
|
-
require '
|
21
|
+
require 'pd' # line 2
|
15
22
|
bug_or_band = 'beattle' # line 3
|
16
23
|
pd bug_or_band # line 4
|
17
24
|
```
|
@@ -19,17 +26,14 @@ pd bug_or_band # line 4
|
|
19
26
|
Output:
|
20
27
|
|
21
28
|
```bash
|
22
|
-
[PD] trivia_app.rb:4
|
29
|
+
[PD] /Users/User/trivia_app.rb:4
|
23
30
|
> pd bug_or_band # line 4
|
24
31
|
=> "beattle"
|
25
32
|
```
|
26
33
|
|
27
34
|
## Background
|
28
35
|
|
29
|
-
|
30
|
-
https://tenderlovemaking.com/2016/02/05/i-am-a-puts-debuggerer.html
|
31
|
-
|
32
|
-
It can be quite frustrating to lose puts statements in a large output or log file. One way to help find them is add a header (e.g. `puts "The Order Total"`) or an announcer (e.g. `puts '*'*80`) before every puts statement. Unfortunately, that leads to repetitive wasteful effort that adds up quickly over many work sessions and interrupts thinking flow while solving problems.
|
36
|
+
It can be quite frustrating to lose puts statements in a large output or log file. One way to help find them is add an announcer (e.g. `puts "The Order Total"`) or a header (e.g. `puts '*'*80`) before every puts statement. Unfortunately, that leads to repetitive wasteful effort that adds up quickly over many work sessions and interrupts thinking flow while solving problems.
|
33
37
|
|
34
38
|
puts_debuggerer automates that work via the short and simple `pd` command, automatically printing meaningful headers for output and accelerating problem solving work due to ease of typing.
|
35
39
|
|
@@ -58,71 +62,225 @@ Which gets lost in a logging stream such as:
|
|
58
62
|
(0.2ms) COMMIT
|
59
63
|
```
|
60
64
|
|
61
|
-
|
65
|
+
Here is a simple example using `pd` instead, which provides everything the puts statements above provide in addition to deducing the file name and line number automatically for dead easy debugging:
|
62
66
|
|
63
67
|
```ruby
|
64
|
-
|
65
|
-
puts "order_total"
|
66
|
-
puts order_total
|
68
|
+
pd order_total
|
67
69
|
```
|
68
70
|
|
69
|
-
|
71
|
+
Output:
|
70
72
|
|
71
|
-
```
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
73
|
+
```
|
74
|
+
(2.7ms) CREATE TABLE "ar_internal_metadata" ("key" character varying PRIMARY KEY, "value" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
|
75
|
+
ActiveRecord::InternalMetadata Load (0.4ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", :environment], ["LIMIT", 1]]
|
76
|
+
(0.2ms) BEGIN
|
77
|
+
SQL (0.3ms) INSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "key" [["key", "environment"], ["value", "development"], ["created_at", 2017-08-24 22:56:52 UTC], ["updated_at", 2017-08-24 22:56:52 UTC]]
|
78
|
+
(0.3ms) COMMIT
|
79
|
+
[PD] /Users/User/ordering/order.rb:39
|
80
|
+
> pd order_total
|
81
|
+
=> 195.50
|
82
|
+
ActiveRecord::InternalMetadata Load (0.3ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", :environment], ["LIMIT", 1]]
|
83
|
+
(0.2ms) BEGIN
|
84
|
+
(0.2ms) COMMIT
|
81
85
|
```
|
82
86
|
|
83
|
-
|
87
|
+
This is not only easy to locate in a logging stream such as the one below, but also announces the `order_total` variable with `[PD]` for easy findability among other pd statements (you may always enter `[PD]` or variable name `order_total` using the CMD+F Quick Find to instantly jump to that line in the log):
|
84
88
|
|
85
89
|
```ruby
|
86
90
|
pd order_total
|
91
|
+
pd order_summary
|
92
|
+
pd order_details
|
87
93
|
```
|
88
94
|
|
89
95
|
Output:
|
90
96
|
|
91
97
|
```
|
98
|
+
(2.7ms) CREATE TABLE "ar_internal_metadata" ("key" character varying PRIMARY KEY, "value" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
|
99
|
+
ActiveRecord::InternalMetadata Load (0.4ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", :environment], ["LIMIT", 1]]
|
92
100
|
[PD] /Users/User/ordering/order.rb:39
|
93
|
-
> pd order_total
|
101
|
+
> pd order_total
|
94
102
|
=> 195.50
|
103
|
+
(0.2ms) BEGIN
|
104
|
+
SQL (0.3ms) INSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "key" [["key", "environment"], ["value", "development"], ["created_at", 2017-08-24 22:56:52 UTC], ["updated_at", 2017-08-24 22:56:52 UTC]]
|
105
|
+
(0.3ms) COMMIT
|
106
|
+
[PD] /Users/User/ordering/order.rb:40
|
107
|
+
> pd order_summary
|
108
|
+
=> "Pragmatic Ruby Book"
|
109
|
+
ActiveRecord::InternalMetadata Load (0.3ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", :environment], ["LIMIT", 1]]
|
110
|
+
(0.2ms) BEGIN
|
111
|
+
(0.2ms) COMMIT
|
112
|
+
[PD] /Users/User/ordering/order.rb:41
|
113
|
+
> pd order_details
|
114
|
+
=> "[Hard Cover] Pragmatic Ruby Book - English Version"
|
115
|
+
```
|
116
|
+
|
117
|
+
What if you would like to add a header for faster findability of groups of related pd statements? Just use the `header` option:
|
118
|
+
|
119
|
+
```ruby
|
120
|
+
pd order_total, header: true
|
121
|
+
pd order_summary
|
122
|
+
pd order_details
|
95
123
|
```
|
96
124
|
|
97
|
-
|
125
|
+
Output:
|
98
126
|
|
99
127
|
```
|
100
128
|
(2.7ms) CREATE TABLE "ar_internal_metadata" ("key" character varying PRIMARY KEY, "value" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
|
101
129
|
ActiveRecord::InternalMetadata Load (0.4ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", :environment], ["LIMIT", 1]]
|
130
|
+
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
102
131
|
[PD] /Users/User/ordering/order.rb:39
|
103
|
-
> pd order_total
|
132
|
+
> pd order_total, header: true
|
104
133
|
=> 195.50
|
105
134
|
(0.2ms) BEGIN
|
106
135
|
SQL (0.3ms) INSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "key" [["key", "environment"], ["value", "development"], ["created_at", 2017-08-24 22:56:52 UTC], ["updated_at", 2017-08-24 22:56:52 UTC]]
|
107
136
|
(0.3ms) COMMIT
|
108
|
-
[PD] /Users/User/ordering/order.rb:
|
109
|
-
> pd
|
110
|
-
=>
|
137
|
+
[PD] /Users/User/ordering/order.rb:40
|
138
|
+
> pd order_summary
|
139
|
+
=> "Pragmatic Ruby Book"
|
111
140
|
ActiveRecord::InternalMetadata Load (0.3ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", :environment], ["LIMIT", 1]]
|
112
141
|
(0.2ms) BEGIN
|
113
142
|
(0.2ms) COMMIT
|
143
|
+
[PD] /Users/User/ordering/order.rb:41
|
144
|
+
> pd order_details
|
145
|
+
=> "[Hard Cover] Pragmatic Ruby Book - English Version"
|
114
146
|
```
|
115
147
|
|
116
|
-
|
148
|
+
Wanna customize the header and add a footer too? No problem:
|
149
|
+
|
150
|
+
```ruby
|
151
|
+
pd order_total, header: '>'*80
|
152
|
+
pd order_summary
|
153
|
+
pd order_details, footer: '<'*80
|
154
|
+
```
|
155
|
+
|
156
|
+
Output:
|
157
|
+
|
158
|
+
```
|
159
|
+
(2.7ms) CREATE TABLE "ar_internal_metadata" ("key" character varying PRIMARY KEY, "value" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
|
160
|
+
ActiveRecord::InternalMetadata Load (0.4ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", :environment], ["LIMIT", 1]]
|
161
|
+
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
162
|
+
[PD] /Users/User/ordering/order.rb:39
|
163
|
+
> pd order_total, header: '>'*80
|
164
|
+
=> 195.50
|
165
|
+
(0.2ms) BEGIN
|
166
|
+
SQL (0.3ms) INSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "key" [["key", "environment"], ["value", "development"], ["created_at", 2017-08-24 22:56:52 UTC], ["updated_at", 2017-08-24 22:56:52 UTC]]
|
167
|
+
(0.3ms) COMMIT
|
168
|
+
[PD] /Users/User/ordering/order.rb:40
|
169
|
+
> pd order_summary
|
170
|
+
=> "Pragmatic Ruby Book"
|
171
|
+
ActiveRecord::InternalMetadata Load (0.3ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", :environment], ["LIMIT", 1]]
|
172
|
+
(0.2ms) BEGIN
|
173
|
+
(0.2ms) COMMIT
|
174
|
+
[PD] /Users/User/ordering/order.rb:41
|
175
|
+
> pd order_details, footer: '<'*80
|
176
|
+
=> "[Hard Cover] Pragmatic Ruby Book - English Version"
|
177
|
+
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
|
178
|
+
```
|
117
179
|
|
118
|
-
|
180
|
+
Need a quick stack trace? Just use the `caller` option (you may surround with header and footer too via `wrapper`).
|
119
181
|
|
120
182
|
```ruby
|
121
|
-
pd order_total
|
183
|
+
pd order_total, caller: true, wrapper: true
|
122
184
|
pd order_summary
|
123
185
|
pd order_details
|
124
186
|
```
|
125
187
|
|
188
|
+
Output:
|
189
|
+
|
190
|
+
```
|
191
|
+
(2.7ms) CREATE TABLE "ar_internal_metadata" ("key" character varying PRIMARY KEY, "value" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
|
192
|
+
ActiveRecord::InternalMetadata Load (0.4ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", :environment], ["LIMIT", 1]]
|
193
|
+
********************************************************************************
|
194
|
+
[PD] /Users/User/ordering/order.rb:39
|
195
|
+
> pd order_total, caller: true, wrapper: true
|
196
|
+
=> 195.50
|
197
|
+
/Users/User/.rvm/gems/ruby-2.7.1/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
|
198
|
+
/Users/User/.rvm/gems/ruby-2.7.1/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
|
199
|
+
/Users/User/.rvm/gems/ruby-2.7.1/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
|
200
|
+
/Users/User/.rvm/gems/ruby-2.7.1/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
|
201
|
+
/Users/User/.rvm/gems/ruby-2.7.1/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
|
202
|
+
/Users/User/.rvm/gems/ruby-2.7.1/gems/activesupport-5.2.4.3/lib/active_support/dependencies.rb:291:in `block in require'
|
203
|
+
/Users/User/.rvm/gems/ruby-2.7.1/gems/activesupport-5.2.4.3/lib/active_support/dependencies.rb:257:in `load_dependency'
|
204
|
+
/Users/User/.rvm/gems/ruby-2.7.1/gems/activesupport-5.2.4.3/lib/active_support/dependencies.rb:291:in `require'
|
205
|
+
/Users/User/.rvm/gems/ruby-2.7.1/gems/railties-5.2.4.3/lib/rails/commands/server/server_command.rb:145:in `block in perform'
|
206
|
+
/Users/User/.rvm/gems/ruby-2.7.1/gems/railties-5.2.4.3/lib/rails/commands/server/server_command.rb:142:in `tap'
|
207
|
+
/Users/User/.rvm/gems/ruby-2.7.1/gems/railties-5.2.4.3/lib/rails/commands/server/server_command.rb:142:in `perform'
|
208
|
+
/Users/User/.rvm/gems/ruby-2.7.1/gems/thor-1.0.1/lib/thor/command.rb:27:in `run'
|
209
|
+
/Users/User/.rvm/gems/ruby-2.7.1/gems/thor-1.0.1/lib/thor/invocation.rb:127:in `invoke_command'
|
210
|
+
/Users/User/.rvm/gems/ruby-2.7.1/gems/thor-1.0.1/lib/thor.rb:392:in `dispatch'
|
211
|
+
/Users/User/.rvm/gems/ruby-2.7.1/gems/railties-5.2.4.3/lib/rails/command/base.rb:69:in `perform'
|
212
|
+
/Users/User/.rvm/gems/ruby-2.7.1/gems/railties-5.2.4.3/lib/rails/command.rb:46:in `invoke'
|
213
|
+
/Users/User/.rvm/gems/ruby-2.7.1/gems/railties-5.2.4.3/lib/rails/commands.rb:18:in `<main>'
|
214
|
+
/Users/User/.rvm/gems/ruby-2.7.1/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
|
215
|
+
/Users/User/.rvm/gems/ruby-2.7.1/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
|
216
|
+
/Users/User/.rvm/gems/ruby-2.7.1/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
|
217
|
+
/Users/User/.rvm/gems/ruby-2.7.1/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
|
218
|
+
/Users/User/.rvm/gems/ruby-2.7.1/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
|
219
|
+
/Users/User/.rvm/gems/ruby-2.7.1/gems/activesupport-5.2.4.3/lib/active_support/dependencies.rb:291:in `block in require'
|
220
|
+
/Users/User/.rvm/gems/ruby-2.7.1/gems/activesupport-5.2.4.3/lib/active_support/dependencies.rb:257:in `load_dependency'
|
221
|
+
/Users/User/.rvm/gems/ruby-2.7.1/gems/activesupport-5.2.4.3/lib/active_support/dependencies.rb:291:in `require'
|
222
|
+
/Users/User/code/sample-glimmer-dsl-opal-rails5-app/bin/rails:9:in `<top (required)>'
|
223
|
+
/Users/User/.rvm/gems/ruby-2.7.1/gems/spring-2.1.0/lib/spring/client/rails.rb:28:in `load'
|
224
|
+
/Users/User/.rvm/gems/ruby-2.7.1/gems/spring-2.1.0/lib/spring/client/rails.rb:28:in `call'
|
225
|
+
/Users/User/.rvm/gems/ruby-2.7.1/gems/spring-2.1.0/lib/spring/client/command.rb:7:in `call'
|
226
|
+
/Users/User/.rvm/gems/ruby-2.7.1/gems/spring-2.1.0/lib/spring/client.rb:30:in `run'
|
227
|
+
/Users/User/.rvm/gems/ruby-2.7.1/gems/spring-2.1.0/bin/spring:49:in `<top (required)>'
|
228
|
+
/Users/User/.rvm/gems/ruby-2.7.1/gems/spring-2.1.0/lib/spring/binstub.rb:11:in `load'
|
229
|
+
/Users/User/.rvm/gems/ruby-2.7.1/gems/spring-2.1.0/lib/spring/binstub.rb:11:in `<top (required)>'
|
230
|
+
/Users/User/code/sample-glimmer-dsl-opal-rails5-app/bin/spring:15:in `require'
|
231
|
+
/Users/User/code/sample-glimmer-dsl-opal-rails5-app/bin/spring:15:in `<top (required)>'
|
232
|
+
bin/rails:3:in `load'
|
233
|
+
bin/rails:3:in `<main>'
|
234
|
+
********************************************************************************
|
235
|
+
(0.2ms) BEGIN
|
236
|
+
SQL (0.3ms) INSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "key" [["key", "environment"], ["value", "development"], ["created_at", 2017-08-24 22:56:52 UTC], ["updated_at", 2017-08-24 22:56:52 UTC]]
|
237
|
+
(0.3ms) COMMIT
|
238
|
+
[PD] /Users/User/ordering/order.rb:40
|
239
|
+
> pd order_summary
|
240
|
+
=> "Pragmatic Ruby Book"
|
241
|
+
ActiveRecord::InternalMetadata Load (0.3ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", :environment], ["LIMIT", 1]]
|
242
|
+
(0.2ms) BEGIN
|
243
|
+
(0.2ms) COMMIT
|
244
|
+
[PD] /Users/User/ordering/order.rb:41
|
245
|
+
> pd order_details
|
246
|
+
=> "[Hard Cover] Pragmatic Ruby Book - English Version"
|
247
|
+
```
|
248
|
+
|
249
|
+
Is the stack trace too long? Shorten it by passing number of lines to display to `caller` option.
|
250
|
+
|
251
|
+
```ruby
|
252
|
+
pd order_total, caller: 3, wrapper: true
|
253
|
+
pd order_summary
|
254
|
+
pd order_details
|
255
|
+
```
|
256
|
+
|
257
|
+
```
|
258
|
+
(2.7ms) CREATE TABLE "ar_internal_metadata" ("key" character varying PRIMARY KEY, "value" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
|
259
|
+
ActiveRecord::InternalMetadata Load (0.4ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", :environment], ["LIMIT", 1]]
|
260
|
+
********************************************************************************
|
261
|
+
[PD] /Users/User/ordering/order.rb:39
|
262
|
+
> pd order_total, caller: 3, wrapper: true
|
263
|
+
=> 195.50
|
264
|
+
/Users/User/.rvm/gems/ruby-2.7.1/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
|
265
|
+
/Users/User/.rvm/gems/ruby-2.7.1/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
|
266
|
+
/Users/User/.rvm/gems/ruby-2.7.1/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
|
267
|
+
********************************************************************************
|
268
|
+
(0.2ms) BEGIN
|
269
|
+
SQL (0.3ms) INSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "key" [["key", "environment"], ["value", "development"], ["created_at", 2017-08-24 22:56:52 UTC], ["updated_at", 2017-08-24 22:56:52 UTC]]
|
270
|
+
(0.3ms) COMMIT
|
271
|
+
[PD] /Users/User/ordering/order.rb:40
|
272
|
+
> pd order_summary
|
273
|
+
=> "Pragmatic Ruby Book"
|
274
|
+
ActiveRecord::InternalMetadata Load (0.3ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", :environment], ["LIMIT", 1]]
|
275
|
+
(0.2ms) BEGIN
|
276
|
+
(0.2ms) COMMIT
|
277
|
+
[PD] /Users/User/ordering/order.rb:41
|
278
|
+
> pd order_details
|
279
|
+
=> "[Hard Cover] Pragmatic Ruby Book - English Version"
|
280
|
+
```
|
281
|
+
|
282
|
+
There are many more options and powerful features in [puts_debuggerer](https://rubygems.org/gems/puts_debuggerer) as detailed below.
|
283
|
+
|
126
284
|
## Instructions
|
127
285
|
|
128
286
|
### Option 1: Bundler
|
@@ -130,7 +288,7 @@ pd order_details
|
|
130
288
|
Add the following to bundler's `Gemfile`.
|
131
289
|
|
132
290
|
```ruby
|
133
|
-
gem 'puts_debuggerer', '~> 0.
|
291
|
+
gem 'puts_debuggerer', '~> 0.10.3'
|
134
292
|
```
|
135
293
|
|
136
294
|
This is the recommended way for [Rails](rubyonrails.org) apps. Optionally, you may create an initializer under `config/initializers` named `puts_debuggerer_options.rb` to enable further customizations as per the [Options](#options) section below.
|
@@ -140,22 +298,39 @@ This is the recommended way for [Rails](rubyonrails.org) apps. Optionally, you m
|
|
140
298
|
Or manually install and require library.
|
141
299
|
|
142
300
|
```bash
|
143
|
-
gem install puts_debuggerer -v0.
|
301
|
+
gem install puts_debuggerer -v0.10.3
|
144
302
|
```
|
145
303
|
|
146
304
|
```ruby
|
147
305
|
require 'puts_debuggerer'
|
148
306
|
```
|
149
307
|
|
308
|
+
Or the shorter form (often helpful to quickly troubleshoot an app):
|
309
|
+
|
310
|
+
```ruby
|
311
|
+
require 'pd'
|
312
|
+
```
|
313
|
+
|
314
|
+
|
150
315
|
### Awesome Print
|
151
316
|
|
152
|
-
puts_debuggerer comes with [awesome_print](https://github.com/awesome-print/awesome_print).
|
317
|
+
[puts_debuggerer](https://rubygems.org/gems/puts_debuggerer) comes with [awesome_print](https://github.com/awesome-print/awesome_print).
|
153
318
|
|
154
|
-
|
319
|
+
It is the default `PutsDebuggerer.print_engine`
|
320
|
+
|
321
|
+
Still, if you do not need it, you may disable by setting `PutsDebuggerer.print_engine` to another value. Example:
|
322
|
+
|
323
|
+
```ruby
|
324
|
+
PutsDebuggerer.print_engine = :puts
|
325
|
+
```
|
326
|
+
|
327
|
+
If you also avoid requiring 'awesome_print', PutsDebuggerer won't require it either if it sees that you have a different `print_engine`
|
328
|
+
|
329
|
+
You may also avoid requiring in Bundler `Gemfile` with `require: false`:
|
155
330
|
|
156
331
|
```ruby
|
157
332
|
gem "awesome_print", require: false
|
158
|
-
gem "
|
333
|
+
gem "puts_debuggerer"
|
159
334
|
```
|
160
335
|
|
161
336
|
### Usage
|
@@ -182,7 +357,7 @@ Output:
|
|
182
357
|
=> "Show me the result of the calculation: 4.0"
|
183
358
|
```
|
184
359
|
|
185
|
-
In addition to the main object/expression output, you get to see the source file name, line number, and source code to help you debug and troubleshoot problems quicker (it even works in IRB).
|
360
|
+
In addition to the main object/expression output, you get to see the source file name, line number, and source code to help you debug and troubleshoot problems quicker (it even works in IRB and Pry).
|
186
361
|
|
187
362
|
Second, quickly locate printed lines using the Find feature (e.g. CTRL+F) by looking for:
|
188
363
|
* [PD]
|
@@ -211,6 +386,20 @@ Output:
|
|
211
386
|
|
212
387
|
Happy puts_debuggerering!
|
213
388
|
|
389
|
+
#### `pd_inspect` kernel method
|
390
|
+
|
391
|
+
You may want to just return the string produced by the `pd` method without printing it.
|
392
|
+
|
393
|
+
In that case, you may use the `pd` alternative to `object.inspect`:
|
394
|
+
- `object.pd_inspect`
|
395
|
+
- `obj.pdi` (shorter alias)
|
396
|
+
|
397
|
+
This returns the `pd` formatted string without printing to the terminal or log files.
|
398
|
+
|
399
|
+
#### Ruby Logger and Logging::Logger
|
400
|
+
|
401
|
+
Ruby Logger and Logging::Logger (from [logging gem](https://github.com/TwP/logging)) are supported as [printers](#putsdebuggererprinter) (learn more under [PutsDebuggerer#printer](#putsdebuggererprinter)).
|
402
|
+
|
214
403
|
### Options
|
215
404
|
|
216
405
|
Options enable more data to be displayed with puts_debuggerer, such as the caller
|
@@ -233,7 +422,7 @@ pd data, header: true
|
|
233
422
|
Prints out:
|
234
423
|
|
235
424
|
```bash
|
236
|
-
|
425
|
+
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
237
426
|
[PD] /Users/User/project/piecemeal.rb:3
|
238
427
|
> pd data, header: true
|
239
428
|
=> [1, [2, 3]]
|
@@ -292,18 +481,38 @@ Header to include at the top of every print out.
|
|
292
481
|
|
293
482
|
Example:
|
294
483
|
|
484
|
+
```ruby
|
485
|
+
pd (x=1), header: true
|
486
|
+
```
|
487
|
+
|
488
|
+
Prints out:
|
489
|
+
|
490
|
+
```bash
|
491
|
+
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
492
|
+
[PD] /Users/User/example.rb:1
|
493
|
+
> pd (x=1), header: true
|
494
|
+
=> "1"
|
495
|
+
```
|
496
|
+
|
497
|
+
Global Option Example:
|
498
|
+
|
295
499
|
```ruby
|
296
500
|
PutsDebuggerer.header = true
|
297
501
|
pd (x=1)
|
502
|
+
pd (x=2)
|
298
503
|
```
|
299
504
|
|
300
505
|
Prints out:
|
301
506
|
|
302
507
|
```bash
|
303
|
-
|
508
|
+
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
304
509
|
[PD] /Users/User/example.rb:2
|
305
|
-
> pd x=1
|
510
|
+
> pd (x=1)
|
306
511
|
=> "1"
|
512
|
+
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
513
|
+
[PD] /Users/User/example.rb:3
|
514
|
+
> pd (x=2)
|
515
|
+
=> "2"
|
307
516
|
```
|
308
517
|
|
309
518
|
#### `PutsDebuggerer.footer`
|
@@ -317,26 +526,140 @@ Footer to include at the bottom of every print out.
|
|
317
526
|
|
318
527
|
Example:
|
319
528
|
|
529
|
+
```ruby
|
530
|
+
pd (x=1), footer: true
|
531
|
+
```
|
532
|
+
|
533
|
+
Prints out:
|
534
|
+
|
535
|
+
```bash
|
536
|
+
[PD] /Users/User/example.rb:1
|
537
|
+
> pd (x=1), footer: true
|
538
|
+
=> "1"
|
539
|
+
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
|
540
|
+
```
|
541
|
+
|
542
|
+
Global Option Example:
|
543
|
+
|
320
544
|
```ruby
|
321
545
|
PutsDebuggerer.footer = true
|
322
546
|
pd (x=1)
|
547
|
+
pd (x=2)
|
323
548
|
```
|
324
549
|
|
325
550
|
Prints out:
|
326
551
|
|
327
552
|
```bash
|
328
553
|
[PD] /Users/User/example.rb:2
|
329
|
-
> pd x=1
|
554
|
+
> pd (x=1)
|
555
|
+
=> "1"
|
556
|
+
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
|
557
|
+
[PD] /Users/User/example.rb:3
|
558
|
+
> pd (x=2)
|
559
|
+
=> "2"
|
560
|
+
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
|
561
|
+
```
|
562
|
+
|
563
|
+
#### `PutsDebuggerer.wrapper`
|
564
|
+
(default = `'*'*80`)
|
565
|
+
|
566
|
+
Wrapper to include at the top and bottom of every print out (both header and footer).
|
567
|
+
* Default value is `nil`
|
568
|
+
* Value `true` enables wrapper as `'*'*80`
|
569
|
+
* Value `false`, `nil`, or empty string disables wrapper
|
570
|
+
* Any other string value gets set as a custom wrapper
|
571
|
+
|
572
|
+
Example:
|
573
|
+
|
574
|
+
```ruby
|
575
|
+
pd (x=1), wrapper: true
|
576
|
+
```
|
577
|
+
|
578
|
+
Prints out:
|
579
|
+
|
580
|
+
```bash
|
581
|
+
********************************************************************************
|
582
|
+
[PD] /Users/User/example.rb:1
|
583
|
+
> pd x=1, wrapper: true
|
330
584
|
=> "1"
|
331
585
|
********************************************************************************
|
332
586
|
```
|
333
587
|
|
588
|
+
Global Option Example:
|
589
|
+
|
590
|
+
```ruby
|
591
|
+
PutsDebuggerer.wrapper = true
|
592
|
+
pd (x=1)
|
593
|
+
pd (x=2)
|
594
|
+
```
|
595
|
+
|
596
|
+
Prints out:
|
597
|
+
|
598
|
+
```bash
|
599
|
+
********************************************************************************
|
600
|
+
[PD] /Users/User/example.rb:2
|
601
|
+
> pd (x=1)
|
602
|
+
=> "1"
|
603
|
+
********************************************************************************
|
604
|
+
********************************************************************************
|
605
|
+
[PD] /Users/User/example.rb:3
|
606
|
+
> pd (x=2)
|
607
|
+
=> "2"
|
608
|
+
********************************************************************************
|
609
|
+
```
|
610
|
+
|
611
|
+
#### `PutsDebuggerer.source_line_count`
|
612
|
+
(default = `1`)
|
613
|
+
|
614
|
+
Prints multiple source code lines as per count specified. Useful when a statement is broken down on multiple lines or when there is a need to get more context around the line printed.
|
615
|
+
|
616
|
+
Example:
|
617
|
+
|
618
|
+
```ruby
|
619
|
+
pd (true ||
|
620
|
+
false), source_line_count: 2
|
621
|
+
```
|
622
|
+
|
623
|
+
Prints out:
|
624
|
+
|
625
|
+
```
|
626
|
+
[PD] /Users/User/example.rb:1
|
627
|
+
> pd (true ||
|
628
|
+
false), source_line_count: 2
|
629
|
+
=> "true"
|
630
|
+
```
|
631
|
+
|
632
|
+
Example:
|
633
|
+
|
634
|
+
```ruby
|
635
|
+
PutsDebuggerer.source_line_count = 2 # setting via global option
|
636
|
+
pd (true ||
|
637
|
+
false)
|
638
|
+
```
|
639
|
+
|
640
|
+
Prints out:
|
641
|
+
|
642
|
+
```
|
643
|
+
[PD] /Users/User/example.rb:2
|
644
|
+
> pd (true ||
|
645
|
+
false), source_line_count: 2
|
646
|
+
=> "true"
|
647
|
+
```
|
648
|
+
|
334
649
|
#### `PutsDebuggerer.printer`
|
335
650
|
(default = `:puts`)
|
336
651
|
|
337
|
-
Printer is a global method symbol
|
338
|
-
|
652
|
+
Printer is a global method symbol, lambda expression, or logger to use in printing to the user.
|
653
|
+
|
654
|
+
Examples of a global method are `:puts` and `:print`.
|
339
655
|
An example of a lambda expression is `lambda {|output| Rails.logger.info(output)}`
|
656
|
+
Examples of a logger are a Ruby `Logger` instance or `Logging::Logger` instance
|
657
|
+
|
658
|
+
When a logger is supplied, it is automatically enhanced with a PutsDebuggerer formatter to use
|
659
|
+
when calling logger methods outside of PutsDebuggerer (e.g. `logger.error('msg')` will use `pd`)
|
660
|
+
|
661
|
+
Printer may be set to `false` to avoid printing and only return the formatted string.
|
662
|
+
It is equivalent of just calling `.pd_inspect` (or alias `.pdi`) on the object
|
340
663
|
|
341
664
|
Defaults to `:puts`
|
342
665
|
In Rails, it defaults to:
|
@@ -388,7 +711,7 @@ pd array
|
|
388
711
|
Prints out:
|
389
712
|
|
390
713
|
```bash
|
391
|
-
[PD] /Users/User/example.rb:
|
714
|
+
[PD] /Users/User/example.rb:4
|
392
715
|
> pd array
|
393
716
|
=> [1, [2, 3]]
|
394
717
|
```
|
@@ -493,6 +816,34 @@ Prints out:
|
|
493
816
|
/Users/User/.rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0/irb/context.rb:381:in \`evaluate\'
|
494
817
|
```
|
495
818
|
|
819
|
+
Global Option Example:
|
820
|
+
|
821
|
+
```ruby
|
822
|
+
# File Name: /Users/User/sample_app/lib/sample.rb
|
823
|
+
PutsDebuggerer.caller = 3 # always print 3 lines only of the stack trace
|
824
|
+
pd (x=1)
|
825
|
+
pd (x=2)
|
826
|
+
```
|
827
|
+
|
828
|
+
Prints out:
|
829
|
+
|
830
|
+
```bash
|
831
|
+
[PD] /Users/User/sample_app/lib/sample.rb:2
|
832
|
+
> pd (x=1)
|
833
|
+
=> "1"
|
834
|
+
/Users/User/sample_app/lib/master_samples.rb:368:in \`block (3 levels) in <top (required)>\'
|
835
|
+
/Users/User/.rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0/irb/workspace.rb:87:in \`eval\'
|
836
|
+
/Users/User/.rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0/irb/workspace.rb:87:in \`evaluate\'
|
837
|
+
/Users/User/.rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0/irb/context.rb:381:in \`evaluate\'
|
838
|
+
[PD] /Users/User/sample_app/lib/sample.rb:3
|
839
|
+
> pd (x=2)
|
840
|
+
=> "2"
|
841
|
+
/Users/User/sample_app/lib/master_samples.rb:368:in \`block (3 levels) in <top (required)>\'
|
842
|
+
/Users/User/.rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0/irb/workspace.rb:87:in \`eval\'
|
843
|
+
/Users/User/.rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0/irb/workspace.rb:87:in \`evaluate\'
|
844
|
+
/Users/User/.rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0/irb/context.rb:381:in \`evaluate\'
|
845
|
+
```
|
846
|
+
|
496
847
|
#### `PutsDebuggerer.run_at`
|
497
848
|
(default = nil)
|
498
849
|
|
@@ -608,28 +959,39 @@ puts __caller_source_line__
|
|
608
959
|
|
609
960
|
Prints out `puts __caller_source_line__`
|
610
961
|
|
611
|
-
##
|
612
|
-
|
613
|
-
|
614
|
-
|
615
|
-
|
616
|
-
|
617
|
-
|
618
|
-
|
619
|
-
|
620
|
-
|
621
|
-
|
622
|
-
|
623
|
-
|
624
|
-
|
625
|
-
|
962
|
+
## Compatibility
|
963
|
+
|
964
|
+
[puts_debuggerer](https://rubygems.org/gems/puts_debuggerer) is fully compatible with:
|
965
|
+
- [Ruby](https://www.ruby-lang.org/en/)
|
966
|
+
- [JRuby](https://www.jruby.org/)
|
967
|
+
- IRB (including Rails Console)
|
968
|
+
- Pry
|
969
|
+
|
970
|
+
### Opal Ruby
|
971
|
+
|
972
|
+
[puts_debuggerer](https://rubygems.org/gems/puts_debuggerer) provides partial-compatibility in [Opal Ruby](https://opalrb.com/) with everything working except:
|
973
|
+
- AwesomePrint (using the `:p` printer instead)
|
974
|
+
- Source code display
|
975
|
+
|
976
|
+
[puts_debuggerer](https://rubygems.org/gems/puts_debuggerer) renders clickable source file/line links in Opal Ruby that take you to the source code in the web browser.
|
977
|
+
|
978
|
+
Here is an example of `pd` output in Opal:
|
979
|
+
|
980
|
+
```
|
981
|
+
[PD] http://localhost:3000/assets/views/garderie_rainbow_daily_agenda/app_view.self-72626d75e0f68a619b1c8ad139535d799d45ab6c730d083820b790d71338e983.js?body=1:72:12
|
982
|
+
>
|
983
|
+
=> "body"
|
984
|
+
```
|
985
|
+
|
986
|
+
Note that it ignores the configured printer when printing exceptions as it relies on Opal's `$stderr.puts` instead to show the stack trace in the web console.
|
987
|
+
|
988
|
+
## Change Log
|
989
|
+
|
990
|
+
[CHANGELOG.md](CHANGELOG.md)
|
626
991
|
|
627
992
|
## TODO
|
628
993
|
|
629
|
-
|
630
|
-
* fix issue with erb support
|
631
|
-
* display run_at run number in printout
|
632
|
-
* implement fallback in irb for when line number cannot be discovered (issue happens in pry, perhaps this just means support pry)
|
994
|
+
[TODO.md](TODO)
|
633
995
|
|
634
996
|
## Contributing
|
635
997
|
|
@@ -645,5 +1007,6 @@ Prints out `puts __caller_source_line__`
|
|
645
1007
|
|
646
1008
|
## Copyright
|
647
1009
|
|
648
|
-
|
649
|
-
|
1010
|
+
[MIT](LICENSE.txt)
|
1011
|
+
|
1012
|
+
Copyright (c) 2017-2020 - Andy Maleh.
|