ruby-dbg 0.1.0 β†’ 0.1.1

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: f49c49046c1082711b730c0a0b1460d36672d1936c9a8419f41c5965fabf17b8
4
- data.tar.gz: 0fe0b76b354e9244c2ac4c04f4baa9cfcf0263dc5680ae50355e1f7f3e7e7fff
3
+ metadata.gz: 0ca651aa1267afde97f2e44eb08f5671b143c3cf2c3903dbac3f3f212995230e
4
+ data.tar.gz: c157e4cc54e79d8f583c7ca27b3d22d7f62f26dcbd171150df7647c1c350615b
5
5
  SHA512:
6
- metadata.gz: 3f5892da2808610e1977a1fd53a247dc122a2626aac43719c2cd89604f452b080a26b68525299f4842fb72f2aa4688163897deba7a6f2b47519949e37ca0e2b7
7
- data.tar.gz: a934c3c861b8cfe800722d659b3eccbbbc332d9941ec06a5d5540e43f1e362eece335a293241da70de31c94f7590f90c1cd83d27d26fe8dedaaf40d2aff5e175
6
+ metadata.gz: 5d2b0c99545d527c6527c86dec6480e17b95b24f3ea31afe46f6bfbbdf6a1bcdc8eabf1c6e3cd53b394eac5a615887d099785b025cd6c85a8b41122740eaad09
7
+ data.tar.gz: f6cdb7be7f68846049582220fbd74b6176150952d3f9c345be0a7f8ad1609440c65f2a3bf180ab37ef9c8c696101e2a96cf764a8dcc55c827c1a803d1656f186
data/README.md CHANGED
@@ -1,4 +1,6 @@
1
1
  # Ruby dbg! [![Gem Version](https://badge.fury.io/rb/ruby-dbg.svg)](https://badge.fury.io/rb/ruby-dbg) [![GH Actions](https://github.com/pawurb/ruby-dbg/actions/workflows/ci.yml/badge.svg)](https://github.com/pawurb/ruby-dbg/actions)
2
+
3
+ ![Dbg base](https://github.com/pawurb/ruby-dbg/raw/main/dbg_base3.png)
2
4
 
3
5
  Because I wrote:
4
6
 
@@ -47,8 +49,9 @@ dbg!(:a, :b)
47
49
  Hash values are pretty printed:
48
50
 
49
51
  ```ruby
50
- dbg!(User.last.as_json)
51
- # [web/users_controller.rb:10 {
52
+ user = User.last.as_json
53
+ dbg!(:user)
54
+ # [web/users_controller.rb:10 user = {
52
55
  # "id": 160111,
53
56
  # "team_id": 1,
54
57
  # "pseudonym": "Anonymous-CBWE",
@@ -62,19 +65,21 @@ You can color the output:
62
65
  ```ruby
63
66
  require "ruby-dbg"
64
67
 
65
- RubyDBG.color_code = 36 # light blue
68
+ RubyDBG.color_code = 35
66
69
  # 31 red
67
70
  # 32 green
68
71
  # 33 yellow
69
72
  # 34 blue
70
73
  # 35 pink
74
+ # 36 light blue
71
75
  ```
72
76
 
73
77
  ```ruby
74
- dbg!("User last", User.last.as_json.slice("id", "slack_id"))
78
+ user = User.last.as_json.slice("id", "slack_id")
79
+ dbg!("User last", :user)
75
80
  ```
76
81
 
77
- ![Diagnose report](https://github.com/pawurb/ruby-dbg/raw/main/dbg_color.png)
82
+ ![Dbg color](https://github.com/pawurb/ruby-dbg/raw/main/dbg_base3.png)
78
83
 
79
84
  If it does not stand out enough, you can enable `dbg!` highlighting:
80
85
 
@@ -85,7 +90,7 @@ require "ruby-dbg"
85
90
  RubyDBG.highlight!("πŸŽ‰πŸ’”πŸ’£πŸ•ΊπŸš€πŸ§¨πŸ™ˆπŸ€―πŸ₯³πŸŒˆπŸ¦„")
86
91
  ```
87
92
 
88
- ![Diagnose report](https://github.com/pawurb/ruby-dbg/raw/main/dbg_emoji.png)
93
+ ![Dbg emoji](https://github.com/pawurb/ruby-dbg/raw/main/dbg_emoji2.png)
89
94
 
90
95
  You can also use `RubyDBG.dbg!(*msgs)` directly or wrap it to rename the helper method:
91
96
 
data/dbg_base3.png ADDED
Binary file
data/dbg_emoji2.png ADDED
Binary file
data/lib/ruby-dbg.rb CHANGED
@@ -45,10 +45,9 @@ module RubyDBG
45
45
  ":#{obj}"
46
46
  end
47
47
  else
48
- obj
48
+ format_val(obj)
49
49
  end
50
50
 
51
- val = format_val(val)
52
51
  output = "#{src} #{val}"
53
52
 
54
53
  if @@highlight
@@ -74,6 +73,8 @@ module RubyDBG
74
73
  def self.format_val(val)
75
74
  if val.nil?
76
75
  "nil"
76
+ elsif val.is_a?(String)
77
+ "\"#{val}\""
77
78
  elsif val.is_a?(Hash)
78
79
  JSON.pretty_generate(val)
79
80
  else
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RubyDBG
4
- VERSION = "0.1.0"
4
+ VERSION = "0.1.1"
5
5
  end
data/spec/smoke_spec.rb CHANGED
@@ -6,7 +6,7 @@ require "ostruct"
6
6
 
7
7
  describe RubyDBG do
8
8
  it "variable values" do
9
- expect { dbg!("123") }.to output("[spec/smoke_spec.rb:9] 123\n").to_stdout
9
+ expect { dbg!("123") }.to output("[spec/smoke_spec.rb:9] \"123\"\n").to_stdout
10
10
  end
11
11
 
12
12
  it "binded variables" do
@@ -29,9 +29,9 @@ describe RubyDBG do
29
29
  expect { dbg!(:s) }.to output("[spec/smoke_spec.rb:29] s = #<OpenStruct a=1, b=2>\n").to_stdout
30
30
  end
31
31
 
32
- it "label case" do
32
+ it "multiple msg" do
33
33
  s = OpenStruct.new(a: 1, b: 2)
34
- expect { dbg!(:s, "other msg") }.to output("[spec/smoke_spec.rb:34] s = #<OpenStruct a=1, b=2>\n[spec/smoke_spec.rb:34] other msg\n").to_stdout
34
+ expect { dbg!(:s, "other msg") }.to output("[spec/smoke_spec.rb:34] s = #<OpenStruct a=1, b=2>\n[spec/smoke_spec.rb:34] \"other msg\"\n").to_stdout
35
35
  end
36
36
 
37
37
  it "nil" do
@@ -40,11 +40,11 @@ describe RubyDBG do
40
40
 
41
41
  it "higlight" do
42
42
  RubyDBG.highlight!
43
- expect { dbg!("123") }.to output("!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n[spec/smoke_spec.rb:43] 123\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n").to_stdout
43
+ expect { dbg!("123") }.to output("!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n[spec/smoke_spec.rb:43] \"123\"\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n").to_stdout
44
44
  end
45
45
 
46
46
  it "color_code" do
47
47
  RubyDBG.color_code = 31
48
- expect { dbg!("123") }.to output("\e[31m!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n[spec/smoke_spec.rb:48] 123\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!\e[0m\n").to_stdout
48
+ expect { dbg!(123) }.to output("\e[31m!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n[spec/smoke_spec.rb:48] 123\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!\e[0m\n").to_stdout
49
49
  end
50
50
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-dbg
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - pawurb
@@ -80,8 +80,9 @@ files:
80
80
  - LICENSE.txt
81
81
  - README.md
82
82
  - Rakefile
83
+ - dbg_base3.png
83
84
  - dbg_color.png
84
- - dbg_emoji.png
85
+ - dbg_emoji2.png
85
86
  - lib/ruby-dbg.rb
86
87
  - lib/ruby_dbg/version.rb
87
88
  - ruby-dbg.gemspec
data/dbg_emoji.png DELETED
Binary file