punchy_pp 0.0.0 → 0.0.2
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/README.md +7 -7
- data/lib/punchy_pp/version.rb +3 -0
- data/lib/punchy_pp.rb +12 -10
- data/lib/railtie.rb +8 -0
- metadata +5 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f4e04e027acca25c4ac861c86a5b9b699279fdca62e1a825c75940dfd6d3a31e
|
|
4
|
+
data.tar.gz: c1a4172697e8803757e0260fe608ff801c8f77700f35a060346fca940a235898
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d086c53ccb99ca5ba471b3c0d3ff2a687bf089ace337756fcc97b7b4624401d61a01a588f7b254098f55f0acffc707ea6e223e973d43bfd92237e5d80efadb6b
|
|
7
|
+
data.tar.gz: e433eed593a2fb20e0446d0cdb390c1631458514da7280cc7283d4f061c74f01b6ee4ee13beaf985257227f44bd2711c9a52432f01bc45f2c2ac5b350e3dfb18
|
data/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
_A "whistle key finder" for you *puts*_
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
##
|
|
6
|
+
## WhAt?
|
|
7
7
|
|
|
8
8
|
* Are you a [puts debuguerer](https://tenderlovemaking.com/2016/02/05/i-am-a-puts-debuggerer/)?
|
|
9
9
|
* You tired of playing 'Where's Waldo' with your `puts`?
|
|
@@ -13,22 +13,22 @@ _A "whistle key finder" for you *puts*_
|
|
|
13
13
|
If any of these is a **YES**, then, my dear friend, here I've got some well-deserved **punchy** for your puts'es
|
|
14
14
|
|
|
15
15
|
## Usage
|
|
16
|
+
If you are using Rails, `bundle add punchy_pp` and you are good to go.
|
|
16
17
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
> Note: `#ppp` stands for `Punchy Pretty Print`, or `Power pp` or _something_ pee pee :thinking:
|
|
18
|
+
If not, then you also need to include punchy_pp's printer method `#ppp` in the top-level object, like so:
|
|
20
19
|
|
|
21
20
|
```ruby
|
|
22
21
|
require "punchy_pp"
|
|
23
|
-
include PunchyPP::Methods
|
|
22
|
+
include PunchyPP::Methods # or self.extend PunchyPP::Methods
|
|
24
23
|
|
|
25
|
-
ppp "
|
|
24
|
+
ppp "Punchy"
|
|
26
25
|
```
|
|
27
26
|
|
|
28
27
|
And you'll get something like:
|
|
29
28
|
|
|
30
29
|

|
|
31
30
|
|
|
31
|
+
|
|
32
32
|
## Development, Contributing, License, CoC, etc, etc, etc
|
|
33
33
|
|
|
34
|
-
MIT, Contributor Covenant Code of Conduct, etc, all the standard stuff Bundler happily made for
|
|
34
|
+
MIT, Contributor Covenant Code of Conduct, etc, all the standard stuff Bundler happily made for us all :grinning: Just reach out with an issue or PR
|
data/lib/punchy_pp.rb
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require "pp"
|
|
4
|
+
require_relative "railtie" if defined?(Rails::Railtie)
|
|
4
5
|
|
|
5
6
|
module PunchyPP
|
|
6
|
-
VERSION = "0.0.0"
|
|
7
|
-
|
|
8
7
|
LINE_CONTINUATIION = "\e[94m···\e[0m "
|
|
9
8
|
PATTERNS = {
|
|
10
9
|
white: "\e[30m\e[107m%s\e[0m",
|
|
@@ -17,19 +16,21 @@ module PunchyPP
|
|
|
17
16
|
red: "\e[97m\e[101m%s\e[0m"
|
|
18
17
|
}
|
|
19
18
|
|
|
20
|
-
|
|
19
|
+
COLOR_QUEUE = Queue.new
|
|
20
|
+
PATTERNS.keys.each do |color|
|
|
21
|
+
COLOR_QUEUE.push(color)
|
|
21
22
|
define_method color do |text|
|
|
22
|
-
|
|
23
|
+
PATTERNS[color] % text
|
|
23
24
|
end
|
|
24
25
|
end
|
|
25
26
|
|
|
26
|
-
COLOR_CYCLE = PATTERNS.keys.cycle
|
|
27
|
-
|
|
28
27
|
def cycle_color
|
|
29
|
-
|
|
28
|
+
color = COLOR_QUEUE.pop
|
|
29
|
+
COLOR_QUEUE.push(color)
|
|
30
|
+
@current_color = config[:color] || color
|
|
30
31
|
end
|
|
31
32
|
|
|
32
|
-
def
|
|
33
|
+
def current_color
|
|
33
34
|
@current_color || cycle_color
|
|
34
35
|
end
|
|
35
36
|
|
|
@@ -42,7 +43,7 @@ module PunchyPP
|
|
|
42
43
|
end
|
|
43
44
|
|
|
44
45
|
def paint(text)
|
|
45
|
-
send
|
|
46
|
+
send current_color, text
|
|
46
47
|
end
|
|
47
48
|
|
|
48
49
|
def border(text = nil)
|
|
@@ -96,10 +97,11 @@ module PunchyPP
|
|
|
96
97
|
out border " "
|
|
97
98
|
end
|
|
98
99
|
|
|
99
|
-
extend self
|
|
100
100
|
module Methods
|
|
101
101
|
def ppp(*objects)
|
|
102
102
|
PunchyPP.puts(*objects)
|
|
103
103
|
end
|
|
104
104
|
end
|
|
105
|
+
|
|
106
|
+
extend self
|
|
105
107
|
end
|
data/lib/railtie.rb
ADDED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: punchy_pp
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Fernando Martínez
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2024-
|
|
11
|
+
date: 2024-09-20 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description: Are you a puts debuguerer too? Tired of playing 'Where's Waldo' with
|
|
14
14
|
your `puts`? Sick of losing and forgeting where the heck you've _put_ them in your
|
|
@@ -29,6 +29,8 @@ files:
|
|
|
29
29
|
- Rakefile
|
|
30
30
|
- image.png
|
|
31
31
|
- lib/punchy_pp.rb
|
|
32
|
+
- lib/punchy_pp/version.rb
|
|
33
|
+
- lib/railtie.rb
|
|
32
34
|
- sig/punchy_pp.rbs
|
|
33
35
|
homepage: https://github.com/sinaptia/punchy_pp
|
|
34
36
|
licenses:
|
|
@@ -50,7 +52,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
50
52
|
- !ruby/object:Gem::Version
|
|
51
53
|
version: '0'
|
|
52
54
|
requirements: []
|
|
53
|
-
rubygems_version: 3.5.
|
|
55
|
+
rubygems_version: 3.5.18
|
|
54
56
|
signing_key:
|
|
55
57
|
specification_version: 4
|
|
56
58
|
summary: The puts debugguerer's indispensable companion
|