You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+6-6Lines changed: 6 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,9 +11,9 @@ If you like [Awesome_Print](https://rubygems.org/gems/awesome_print) (or [Amazin
11
11
12
12
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.
13
13
14
-
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 numberswere invoked, identifying which variables were printed, and seeing the content of structured hashes and arrays in an understandable format.
14
+
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 files, line numbers, and methods the puts statements were invoked from, identifying which variables were printed, and seeing the content of structured hashes and arrays in an understandable format.
15
15
16
-
Enter [puts_debuggerer](https://rubygems.org/gems/puts_debuggerer)! A guilt-free puts debugging Ruby gem FTW that prints file names, line numbers, invoked class methods, code statements, headers, footers, stack traces, and formats output nicely courtesy of [awesome_print](https://rubygems.org/gems/awesome_print) (or [amazing_print](https://github.com/amazing-print/amazing_print) if you prefer).
16
+
Enter [puts_debuggerer](https://rubygems.org/gems/puts_debuggerer)! A guilt-free puts debugging Ruby gem FTW that prints file names, line numbers, class names, method names, code statements, headers, footers, and stack traces; and formats output nicely courtesy of [awesome_print](https://rubygems.org/gems/awesome_print) (or [amazing_print](https://github.com/amazing-print/amazing_print) if you prefer).
17
17
18
18
[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).
19
19
@@ -39,7 +39,7 @@ Output:
39
39
=>"Beatles"
40
40
```
41
41
42
-
`pd` revealed that the variable contains the band name "Beatles" as its value not the bug "Beetle", in addition to revealing the printed code statement `pd bug_or_band`, the file name `/Users/User/trivia_app.rb`, the line number `6`, the class name `TriviaApp`, and the invoked method name `question`.
42
+
`pd` revealed that the variable contains the band name "Beatles" as its value not the bug "Beetle", in addition to revealing the printed code statement `pd bug_or_band`, the file name `/Users/User/trivia_app.rb`, the line number `6`, the class name `TriviaApp`, and the method name `question`.
43
43
44
44
## Background
45
45
@@ -72,7 +72,7 @@ Which gets lost in a logging stream such as:
72
72
(0.2ms) COMMIT
73
73
```
74
74
75
-
Here is a simple example using `pd` instead, which provides everything the puts statements above provide in addition to deducing the file name, line number, and invoked class method automatically for dead-easy debugging:
75
+
Here is a simple example using `pd` instead, which provides everything the puts statements above provide in addition to deducing the file name, line number, class name, and method name automatically for dead-easy debugging:
76
76
77
77
```ruby
78
78
pd order_total
@@ -418,7 +418,7 @@ Output:
418
418
=> "Beatles"
419
419
```
420
420
421
-
In addition to the object/expression output, you get to see the source file name, line number, invoked class method, and source code to help you debug and troubleshoot problems quicker (it even works in IRB).
421
+
In addition to the object/expression output, you get to see the source file name, line number, class name, method name, and source code to help you debug and troubleshoot problems quicker (it even works in IRB).
422
422
423
423
You can use `pd` at the top-level main object too, and it prings `Object.<main>` for the class/method.
424
424
@@ -831,7 +831,7 @@ Prints out the following in standard out stream only (not in log files):
831
831
832
832
Print engine is similar to `printer`, except it is focused on the scope of formatting
833
833
the data object being printed (excluding metadata such as file name, line number,
834
-
invoked class method, and expression, which are handled by the `printer`).
834
+
class name, method name, and expression, which are handled by the `printer`).
835
835
As such, it is also a global method symbol or lambda expression.
836
836
Examples of global methods are `:p`, `:ap`, and `:pp`.
837
837
An example of a lambda expression is `lambda {|object| puts object.to_a.join(" | ")}`
gem.summary=%Q{Ruby library for improved puts debugging, automatically displaying bonus useful information such as source file name, line number, invoked class method, and source code.}
20
+
gem.summary=%Q{Ruby library for improved puts debugging, automatically displaying bonus useful information such as source file name, line number, class name, method name, and source code.}
21
21
gem.description=<<-MULTI
22
22
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.
23
-
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. Problem is you need to locate puts statements in large output logs, know which methods were invoked, find out what variable names are being printed, and see nicely formatted output. Enter puts_debuggerer. A guilt-free puts debugging Ruby gem FTW that prints file names, line numbers, invoked class methods, code statements, and formats output nicely courtesy of awesome_print.
23
+
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. Problem is you need to locate puts statements in large output logs, know which file names, line numbers, classes, and methods contained the puts statements, find out what variable names are being printed, and see nicely formatted output. Enter puts_debuggerer. A guilt-free puts debugging Ruby gem FTW that prints file names, line numbers, class names, method names, and code statements; and formats output nicely courtesy of awesome_print.
24
24
Partially inspired by this blog post: https://tenderlovemaking.com/2016/02/05/i-am-a-puts-debuggerer.html (Credit to Tenderlove.)
s.description="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.\nIn 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. Problem is you need to locate puts statements in large output logs, know which methods were invoked, find out what variable names are being printed, and see nicely formatted output. Enter puts_debuggerer. A guilt-free puts debugging Ruby gem FTW that prints file names, line numbers, invoked class methods, code statements, and formats output nicely courtesy of awesome_print.\nPartially inspired by this blog post: https://tenderlovemaking.com/2016/02/05/i-am-a-puts-debuggerer.html (Credit to Tenderlove.)\n".freeze
14
+
s.date="2024-06-04"
15
+
s.description="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.\nIn 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. Problem is you need to locate puts statements in large output logs, know which file names, line numbers, classes, and methods contained the puts statements, find out what variable names are being printed, and see nicely formatted output. Enter puts_debuggerer. A guilt-free puts debugging Ruby gem FTW that prints file names, line numbers, class names, method names, and code statements; and formats output nicely courtesy of awesome_print.\nPartially inspired by this blog post: https://tenderlovemaking.com/2016/02/05/i-am-a-puts-debuggerer.html (Credit to Tenderlove.)\n".freeze
s.summary="Ruby library for improved puts debugging, automatically displaying bonus useful information such as source file name, line number, invoked class method, and source code.".freeze
37
+
s.summary="Ruby library for improved puts debugging, automatically displaying bonus useful information such as source file name, line number, class name, method name, and source code.".freeze
0 commit comments