puts_debuggerer 0.12.0 → 0.13.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 85cc76378a88f1e7c8019f347e69070190ca4f051619fc60dee05d2ff3e83dda
4
- data.tar.gz: fb66e2375aa5624c8910d429032e9d99367b1ed5560aa7e364bd431167f5a291
3
+ metadata.gz: 9dcb8700ea76c5b172428f7a4c08285244da367442f8a5bb90b45d1c25f7b107
4
+ data.tar.gz: ee730414f3252a164a5ff1d0f4321564dc9c11e36e72f7e2f63998128dbf2c1a
5
5
  SHA512:
6
- metadata.gz: e61dc7234af7e6392bc61a8510a63846c65a6cf305e5ba2dd2ce807d6ec72d259675cf0f32bddb45709d0d823e2123d8e3ce4ecce14c8165bb15874354128c24
7
- data.tar.gz: 5140b36a4d575b4f27e19929c70437d8e30a45d5085b682106868c2e915e49be6744a6aea772946b8e05b3ec2d1ed4d3be21ba163dec2db56a21eeaa6b991650
6
+ metadata.gz: 40dcf3829312a9d2d30f77371c7296d0f4511d41917263e26248d8d9add0950847effe52a1afb4cec823e8afa4449426a4ab5e2f2aa86e107458aca4ac78ee4a
7
+ data.tar.gz: efc7adc8820b1ff2a483e88e4255a3dc3280fee16d22750a079e16c7f4de82023d811efa0dbf47e100cb4777e518e7c2c845c70a01878b47e8aa5b67ac9c99c4
data/CHANGELOG.md CHANGED
@@ -1,8 +1,14 @@
1
1
  # Change Log
2
2
 
3
+ ## 0.13.0
4
+
5
+ - Support `h: :t` shortcut to passing `header: true`
6
+ - Support `f: :t` shortcut to passing `footer: true`
7
+ - Support `w: :t` shortcut to passing `wrapper: true`
8
+
3
9
  ## 0.12.0
4
10
 
5
- - Upgrade `awesome_print` to `~> 0.9.2`
11
+ - Upgrade `awesome_print` to `~> 1.9.2`
6
12
  - Support passing pd options as part of a printed hash instead of requiring a separate hash (e.g. `pd(path: path, header: true)` instead of `pd({path: path}, header: true)` )
7
13
  - Support empty use of pd statement + options (e.g. `pd` or `pd header: true`)
8
14
 
data/README.md CHANGED
@@ -114,7 +114,7 @@ Output:
114
114
  => "[Hard Cover] Pragmatic Ruby Book - English Version"
115
115
  ```
116
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:
117
+ What if you would like to add a header for faster findability of groups of related pd statements? Just use the `header` option (or `h`):
118
118
 
119
119
  ```ruby
120
120
  pd order_total, header: true
@@ -177,7 +177,7 @@ Output:
177
177
  <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
178
178
  ```
179
179
 
180
- Need a quick stack trace? Just use the `caller` option (you may surround with header and footer too via `wrapper`).
180
+ Need a quick stack trace? Just use the `caller` option (you may surround with header and footer too via `wrapper` or `w`).
181
181
 
182
182
  ```ruby
183
183
  pd order_total, caller: true, wrapper: true
@@ -279,7 +279,7 @@ pd order_details
279
279
  => "[Hard Cover] Pragmatic Ruby Book - English Version"
280
280
  ```
281
281
 
282
- There are many more options and powerful features in [puts_debuggerer](https://rubygems.org/gems/puts_debuggerer) as detailed below.
282
+ There are many more options and features in [puts_debuggerer](https://rubygems.org/gems/puts_debuggerer) as detailed below.
283
283
 
284
284
  ## Instructions
285
285
 
@@ -288,7 +288,7 @@ There are many more options and powerful features in [puts_debuggerer](https://r
288
288
  Add the following to bundler's `Gemfile`.
289
289
 
290
290
  ```ruby
291
- gem 'puts_debuggerer', '~> 0.12.0'
291
+ gem 'puts_debuggerer', '~> 0.13.0'
292
292
  ```
293
293
 
294
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.
@@ -298,7 +298,7 @@ This is the recommended way for [Rails](rubyonrails.org) apps. Optionally, you m
298
298
  Or manually install and require library.
299
299
 
300
300
  ```bash
301
- gem install puts_debuggerer -v0.12.0
301
+ gem install puts_debuggerer -v0.13.0
302
302
  ```
303
303
 
304
304
  ```ruby
@@ -493,6 +493,21 @@ Prints out:
493
493
  => "1"
494
494
  ```
495
495
 
496
+ Shortcut Example:
497
+
498
+ ```ruby
499
+ pd (x=1), h: :t
500
+ ```
501
+
502
+ Prints out:
503
+
504
+ ```bash
505
+ >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
506
+ [PD] /Users/User/example.rb:1
507
+ > pd (x=1), h: :t
508
+ => "1"
509
+ ```
510
+
496
511
  Global Option Example:
497
512
 
498
513
  ```ruby
@@ -538,6 +553,21 @@ Prints out:
538
553
  <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
539
554
  ```
540
555
 
556
+ Shortcut Example:
557
+
558
+ ```ruby
559
+ pd (x=1), f: :t
560
+ ```
561
+
562
+ Prints out:
563
+
564
+ ```bash
565
+ [PD] /Users/User/example.rb:1
566
+ > pd (x=1), f: :t
567
+ => "1"
568
+ <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
569
+ ```
570
+
541
571
  Global Option Example:
542
572
 
543
573
  ```ruby
@@ -584,6 +614,22 @@ Prints out:
584
614
  ********************************************************************************
585
615
  ```
586
616
 
617
+ Shortcut Example:
618
+
619
+ ```ruby
620
+ pd (x=1), w: :t
621
+ ```
622
+
623
+ Prints out:
624
+
625
+ ```bash
626
+ ********************************************************************************
627
+ [PD] /Users/User/example.rb:1
628
+ > pd x=1, w: :t
629
+ => "1"
630
+ ********************************************************************************
631
+ ```
632
+
587
633
  Global Option Example:
588
634
 
589
635
  ```ruby
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.12.0
1
+ 0.13.0
@@ -63,7 +63,12 @@ module PutsDebuggerer
63
63
  STACK_TRACE_CALL_LINE_NUMBER_REGEX = /\:(\d+)\:in /
64
64
  STACK_TRACE_CALL_SOURCE_FILE_REGEX = /[ ]*([^:]+)\:\d+\:in /
65
65
  STACK_TRACE_CALL_SOURCE_FILE_REGEX_OPAL = /(http[^\)]+)/
66
- OPTIONS = [:app_path, :source_line_count, :header, :wrapper, :footer, :printer, :print_engine, :announcer, :formatter, :caller, :run_at]
66
+ OPTIONS = [:app_path, :source_line_count, :header, :h, :wrapper, :w, :footer, :f, :printer, :print_engine, :announcer, :formatter, :caller, :run_at]
67
+ OPTION_ALIASES = {
68
+ h: :header,
69
+ f: :footer,
70
+ w: :wrapper
71
+ }
67
72
 
68
73
  class << self
69
74
  # Application root path to exclude when printing out file path
@@ -471,14 +476,18 @@ module PutsDebuggerer
471
476
 
472
477
  def determine_options(objects)
473
478
  if objects.size > 1 && objects.last.is_a?(Hash)
474
- objects.delete_at(-1)
479
+ convert_options(objects.delete_at(-1))
475
480
  elsif objects.size == 1 && objects.first.is_a?(Hash)
476
481
  hash = objects.first
477
- hash.slice(*OPTIONS).tap do
482
+ convert_options(hash.slice(*OPTIONS).tap do
478
483
  hash.delete_if {|option| OPTIONS.include?(option)}
479
- end
484
+ end)
480
485
  end
481
486
  end
487
+
488
+ def convert_options(hash)
489
+ Hash[hash.map { |key, value| OPTION_ALIASES[key] ? ( value == :t ? [OPTION_ALIASES[key], true] : [OPTION_ALIASES[key], value] ) : [key, value]}]
490
+ end
482
491
 
483
492
  def determine_object(objects)
484
493
  objects.compact.size > 1 ? objects : objects.first
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: puts_debuggerer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.0
4
+ version: 0.13.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Maleh
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-03-15 00:00:00.000000000 Z
11
+ date: 2021-07-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: awesome_print
@@ -206,7 +206,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
206
206
  - !ruby/object:Gem::Version
207
207
  version: '0'
208
208
  requirements: []
209
- rubygems_version: 3.2.3
209
+ rubygems_version: 3.2.22
210
210
  signing_key:
211
211
  specification_version: 4
212
212
  summary: Ruby library for improved puts debugging, automatically displaying bonus