Sunday, March 05, 2017

puts_debuggerer v0.3.0 (header/footer + multi-line)

What's New in puts_debuggerer v0.3.0 ?

Usage
Simply invoke global pd method anywhere you'd like to see line number and source code with output. If the argument is a pure string, the print out is simplified by not showing duplicate source.
Quickly locate printed lines using Find feature (e.g. CTRL+F) by looking for:
  • [PD]
  • file:line_number
  • ruby expression.
This gives you the added benefit of easily removing your pd statements later on from the code.
Happy puts_debuggerering!
Example Code:
# /Users/User/finance_calculator_app/pd_test.rb # line 1
bug = 'beattle'                                 # line 2
pd "Show me the source of the bug: #{bug}"      # line 3
pd 'What line number am I?'                     # line 4
Example Printout:
[PD] /Users/User/finance_calculator_app/pd_test.rb:3
   > ("Show me the source of the bug: #{bug}").inspect
  => "Show me the source of the bug: beattle"
[PD] /Users/User/finance_calculator_app/pd_test.rb:4 "What line number am I?"

PutsDebuggerer.header

Header to include at the top of every print out.
  • Default value is nil
  • Value true enables header as '*'*80
  • Value falsenil, or empty string disables header
  • Any other string value gets set as a custom header
Example:
PutsDebuggerer.header = true
pd (x=1)
Prints out:
********************************************************************************
[PD] /Users/User/example.rb:2
   > (x=1).inspect
  => "1"

PutsDebuggerer.footer

Footer to include at the bottom of every print out.
  • Default value is nil
  • Value true enables footer as '*'*80
  • Value falsenil, or empty string disables footer
  • Any other string value gets set as a custom footer
Example:
PutsDebuggerer.footer = true
pd (x=1)
Prints out
[PD] /Users/User/example.rb:2
   > (x=1).inspect
  => "1"
********************************************************************************

Become a puts_debuggerer!

No comments: