extra_print 2.0.0 → 2.1.0

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.
Files changed (3) hide show
  1. checksums.yaml +5 -5
  2. data/lib/extra_print.rb +16 -15
  3. metadata +7 -8
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 2cc49409e4be0233306cef829101163c967cbc2a
4
- data.tar.gz: 650c8cf22e18542d27d1ec297e7098383755b574
2
+ SHA256:
3
+ metadata.gz: dfe8a5100f310b7b5da6bedb50b30d6d9185ed282018a53bfb194b6a4063197c
4
+ data.tar.gz: fce01555d9b632bccff51614eab30da00e137c8da9a036d1c549cf3dfbd4dfa0
5
5
  SHA512:
6
- metadata.gz: ff36e93cea7e7badf3947b33c3f98418b0622aa8b42412f5fe27ead2d853ec972067e83a87859405b976fa6c3357c481360db601c840cfd3fd128be488f52441
7
- data.tar.gz: 9acccfad7f9dc44f65befe9d178d43b7a390ddc163668ede8a5361910867a65fec150bbc9c249aa8d1ddf43cf0d2918a3d80ac9696d464b9e535ac81600b8f58
6
+ metadata.gz: 1ad32ddbd8a3b76e43e621c7177cb30f7e0c05954c7fbb4797c605475602f2fe7b4fd1e648e4f0d99994204ce99ff11f6fc394e499dd0b2a019a0359ceccb637
7
+ data.tar.gz: d5b5339c8e65a97c4f3a9811d9eee066640aaf8f20785a80961045e0b1febe2953eb275b3943207baa01ef8b38d5eba7ae09d011268a199375315a5ebff55f4d
@@ -2,7 +2,7 @@ $COLORS = {'red' => '031','green' => '032','yellow' => '033','blue' => '034','ma
2
2
  $EMOJIS = %w"😎 😈 👹 👺 👻 👿 💀 👽 😂 🤣 🎃 🐶 🦊 ⭐ 🌟 🏈 🏀 ⚽ ⛔ ♻️ ❓ 💽 🎁 🌠 🥓 🥑 🥦 🍤 🍗 🍖 🍕 🍰 🥃 💰 🍦 🍭 🤯 🤬 🐞 💛 💚 💙 💜"
3
3
 
4
4
  #### DEBUGGING gems ####
5
- # require 'awesome_print'
5
+ # require 'amazing_print'
6
6
  # require 'pry-byebug'
7
7
  ########################
8
8
 
@@ -12,7 +12,7 @@ $EMOJIS = %w"😎 😈 👹 👺 👻 👿 💀 👽 😂 🤣 🎃 🐶 🦊
12
12
  # There are cleaner ways of doing the color manipulation
13
13
  # But this approach avoids extra dependencies, which is better :-)
14
14
 
15
- # Simply call pe or pea (extra_awesome_print) and pass a variable you want to inspect.
15
+ # Simply call pe or pea (extra_amazing_print) and pass a variable you want to inspect.
16
16
  # Alternatively, call pe or pea with no arguments to display an emoji line break and calling line info.
17
17
 
18
18
  def pe(*args)
@@ -49,10 +49,10 @@ end
49
49
 
50
50
  private
51
51
 
52
- def extra_print(variable = nil, msg = nil, add_awesome_print = false)
52
+ def extra_print(variable = nil, msg = nil, add_amazing_print = false)
53
53
  # Set variables
54
+ @msg = msg
54
55
  @variable = variable
55
- @msg = msg ? msg : " FINISH "
56
56
 
57
57
  # No red/green if calling from a spec
58
58
  if $0.split('.').last[/spec|test/]
@@ -67,9 +67,9 @@ def extra_print(variable = nil, msg = nil, add_awesome_print = false)
67
67
  end
68
68
 
69
69
  # View Methods
70
- display_detail_header
71
- display_variable(add_awesome_print)
72
- display_footer
70
+ display_detail_bar(true)
71
+ display_variable(add_amazing_print)
72
+ @msg ? display_msg_footer : display_detail_bar(false)
73
73
  end
74
74
 
75
75
  # Checks to see if running in a Ruby file
@@ -88,11 +88,11 @@ def path_clip
88
88
  @caller_path[0].split('/').last(2).join('/').split(':in')[0]
89
89
  end
90
90
 
91
- def display_variable(add_awesome_print)
91
+ def display_variable(add_amazing_print)
92
92
  proc = Proc.new { @variable }
93
- if add_awesome_print
94
- require 'awesome_print'
95
- AwesomePrint.defaults = {
93
+ if add_amazing_print
94
+ require 'amazing_print'
95
+ AmazingPrint.defaults = {
96
96
  indent: -2, # left aligned
97
97
  sort_keys: true, # sort hash keys
98
98
  }
@@ -111,18 +111,19 @@ def display_emoji_break
111
111
  end
112
112
 
113
113
  # TODO: off by one error on dynamic footer length
114
- def display_footer
114
+ def display_msg_footer
115
115
  str = "\033[#{@color}m⬆ " * ((@length / 4) - (@msg.length / 2) - 1)
116
116
  str += "\033[#{@secondary_color}m #{@msg} "
117
117
  str += "\033[#{@color}m⬆ \033[0m" * ((@length / 4))
118
118
  puts str
119
119
  end
120
120
 
121
- def display_detail_header
121
+ def display_detail_bar(top_bar = true)
122
+ arrow = top_bar ? "⬇" : "⬆"
122
123
 
123
124
  # Initial arrows with a new line padding the top
124
125
  str = ""
125
- str += "\033[#{@color}m \033[m" * 5
126
+ str += "\033[#{@color}m#{arrow} \033[m" * 5
126
127
 
127
128
  # Variable Class Display
128
129
  str += "\033[#{@color}m CLASS:\033[m"
@@ -139,7 +140,7 @@ def display_detail_header
139
140
  str += "\033[#{@secondary_color}m #{path_clip} \033[m"
140
141
 
141
142
  # Closing arrows
142
- str += "\033[#{@color}m \033[m" * 5
143
+ str += "\033[#{@color}m#{arrow} \033[m" * 5
143
144
 
144
145
  # Output completed string
145
146
  puts
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: extra_print
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hunter T. Chapman
@@ -11,25 +11,25 @@ cert_chain: []
11
11
  date: 2018-04-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: awesome_print
14
+ name: amazing_print
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.8'
19
+ version: '1.1'
20
20
  - - ">="
21
21
  - !ruby/object:Gem::Version
22
- version: 1.8.0
22
+ version: 1.1.0
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
27
  - - "~>"
28
28
  - !ruby/object:Gem::Version
29
- version: '1.8'
29
+ version: '1.1'
30
30
  - - ">="
31
31
  - !ruby/object:Gem::Version
32
- version: 1.8.0
32
+ version: 1.1.0
33
33
  description: 'Debugging Companion: Informative variable inspection || visual breaks.'
34
34
  email: bootcoder@gmail.com
35
35
  executables: []
@@ -56,8 +56,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
56
56
  - !ruby/object:Gem::Version
57
57
  version: '0'
58
58
  requirements: []
59
- rubyforge_project:
60
- rubygems_version: 2.6.11
59
+ rubygems_version: 3.1.2
61
60
  signing_key:
62
61
  specification_version: 4
63
62
  summary: Easily spot variables printed in a busy console.