punchy_pp 0.0.1 → 0.0.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 41613db37b6adcb37ea857a08ff62ef9e1294c1492a432a1af59bfd76781c00c
4
- data.tar.gz: 4c13f28593813694b4ce311ed32a496940baea4b98d6bc967538cd485b25c7d3
3
+ metadata.gz: d5e373ccec14fdbed69d91a9acd1986036d9b4d94894d3254c467f10f635893c
4
+ data.tar.gz: 87046eaeadb110e295c8c01cf966b2b15c77097f6ef8052c5caa4969466de2f3
5
5
  SHA512:
6
- metadata.gz: b86e12465e3ff52643d4331213a85ea43bbd83f04064ee1bde9e893ebb538daa05b739809e0df85197e9a1b51a7d158490a7f21b9c4428b952d93314f4ce4c13
7
- data.tar.gz: a50f1be541ffbe0c4b9c724735272f7c5b7c0a9025316eaad03ab8e6047797228ca5e1f7cc047b7433f66c9687a0531ba9ee12086a2d4d7abe778be4244141e3
6
+ metadata.gz: a0ea9d8597a47f7eafb88bc8ea15fd3c8a98595aea94f3872d1dbe2cbf17d8add5b180ae135496af765131d908f359449a9608c636563b004296b4e7f4c8821e
7
+ data.tar.gz: ce799ed218fb34ed9c422ac6f4ec3e20fd7b2328b7333e655606fab0caccdb37918b33bca35fcdfb7820d2738aa4cb90dfc34c5b4ec7dc42a7357f62b812f0e6
data/README.md CHANGED
@@ -13,13 +13,13 @@ _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` or `gem install punchy_pp` and you are good to go.
16
+ If you are using Rails, `bundle add punchy_pp` and you are good to go.
17
17
 
18
18
  If not, then you also need to include punchy_pp's printer method `#ppp` in the top-level object, like so:
19
19
 
20
20
  ```ruby
21
21
  require "punchy_pp"
22
- include PunchyPP::Methods
22
+ include PunchyPP::Methods # or self.extend PunchyPP::Methods
23
23
 
24
24
  ppp "Punchy"
25
25
  ```
@@ -28,6 +28,7 @@ And you'll get something like:
28
28
 
29
29
  ![image of command line interface with very conspicuous strings](image.png)
30
30
 
31
+
31
32
  ## Development, Contributing, License, CoC, etc, etc, etc
32
33
 
33
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
@@ -1,3 +1,3 @@
1
1
  module PunchyPP
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.3"
3
3
  end
data/lib/punchy_pp.rb CHANGED
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "pp"
4
- require_relative "railtie" if defined?(Rails::Railtie)
5
4
 
6
5
  module PunchyPP
7
6
  LINE_CONTINUATIION = "\e[94m···\e[0m "
@@ -16,16 +15,18 @@ module PunchyPP
16
15
  red: "\e[97m\e[101m%s\e[0m"
17
16
  }
18
17
 
19
- PATTERNS.each do |color, pattern|
18
+ COLOR_QUEUE = Queue.new
19
+ PATTERNS.keys.each do |color|
20
+ COLOR_QUEUE.push(color)
20
21
  define_method color do |text|
21
- pattern % text
22
+ PATTERNS[color] % text
22
23
  end
23
24
  end
24
25
 
25
- COLOR_CYCLE = PATTERNS.keys.cycle
26
-
27
26
  def cycle_color
28
- @current_color = config[:color] || COLOR_CYCLE.next
27
+ color = COLOR_QUEUE.pop
28
+ COLOR_QUEUE.push(color)
29
+ @current_color = config[:color] || color
29
30
  end
30
31
 
31
32
  def current_color
@@ -95,11 +96,11 @@ module PunchyPP
95
96
  out border " "
96
97
  end
97
98
 
98
- module Methods
99
- def ppp(*objects)
100
- PunchyPP.puts(*objects)
101
- end
102
- end
103
-
104
99
  extend self
105
100
  end
101
+
102
+ module Kernel
103
+ def ppp(*objects)
104
+ PunchyPP.puts(*objects)
105
+ end
106
+ end
data/lib/railtie.rb CHANGED
@@ -1,8 +1,7 @@
1
1
  module PunchyPP
2
2
  class Railtie < ::Rails::Railtie
3
- initializer "punchy_pp.include_methods" do
4
- main = Object.const_get(:TOPLEVEL_BINDING).eval("self")
5
- main.extend(PunchyPP::Methods)
3
+ initializer "punchy_pp.require" do
4
+ require "punchy_pp"
6
5
  end
7
6
  end
8
7
  end
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.1
4
+ version: 0.0.3
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-08-16 00:00:00.000000000 Z
11
+ date: 2025-03-14 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
@@ -52,7 +52,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
52
52
  - !ruby/object:Gem::Version
53
53
  version: '0'
54
54
  requirements: []
55
- rubygems_version: 3.5.3
55
+ rubygems_version: 3.5.23
56
56
  signing_key:
57
57
  specification_version: 4
58
58
  summary: The puts debugguerer's indispensable companion