xprint 0.9.3 → 0.9.4

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 (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/version.rb +1 -1
  3. data/lib/xprint.rb +10 -3
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cb5466745989b6f6b023b74f46af89fd0dfb6ff6c10ced23260209bb288aa80d
4
- data.tar.gz: e434c017113835cf167843c788eff0ae215336ec0922fcb14ff3e0b4da8092cc
3
+ metadata.gz: 18c9cf643712db2a4ea35df4719149c8d768c38405112414dde3340145b7b06f
4
+ data.tar.gz: 1d7a04da4c419a33d4c913e5b55bda84505fa49470684d40faff7f6db4e4afbd
5
5
  SHA512:
6
- metadata.gz: af1bf6ed25d0ec37d81e06cb1dec4d4608b4f4cf6e247aa072df8673014dc4f0a6411b0db2edfe6dd32289353d3662c6368eb3148b277edb69182bb756ef0b93
7
- data.tar.gz: 8465b18e98ec0d5c71e3e0536d86db8789c7b8625017627175570c883801ce77e951d3e4fc03f5ef949ac61cd1c15c6f123de514718149d28185315971d4544b
6
+ metadata.gz: d3a7d4aa21c08354ca7435cdca38cc7aa44ae45a3090664328195b47dc6b7b7ad86016974ee1901a653b0d02339f52f103b0990a919f73e9192cafb06e2666a1
7
+ data.tar.gz: f29a49b31589be8642d0c43742612a40c5a3ab324195e06c4000b43c9a7275adfcac0dfdb3752b5f1f3834ab0562a752e11852e5a4f50a03585dfe3d3f19a8f2
@@ -1,3 +1,3 @@
1
1
  module XPrint
2
- VERSION = '0.9.3'
2
+ VERSION = '0.9.4'
3
3
  end
@@ -2,6 +2,8 @@ require 'bigdecimal'
2
2
  require 'date'
3
3
  require 'yaml'
4
4
 
5
+ # TODO: Add ability for alphabetically sorting
6
+ # items in hashes and objects.
5
7
  module XPrint
6
8
  @data_classes = [
7
9
  String, Integer, Float, TrueClass, FalseClass, NilClass,
@@ -23,7 +25,7 @@ module XPrint
23
25
  bigdecimal: :darkcyan,
24
26
  classname: :darkgreen,
25
27
  classobject: :green,
26
- comma: :default,
28
+ comma: :default,
27
29
  curly_brace: :default,
28
30
  date: :red,
29
31
  datetime: :purple,
@@ -230,7 +232,10 @@ module XPrint
230
232
  result += "#{data}"
231
233
 
232
234
  unless index + 1 == x.length
233
- result += "#{@commas ? "#{comma} " : ''} \n"
235
+ show_commas = @commas && @braces
236
+
237
+ result += "#{show_commas ? "#{comma}" : ''}"
238
+ result += "\n" unless result.end_with? "\n"
234
239
  end
235
240
  end
236
241
 
@@ -278,7 +283,9 @@ module XPrint
278
283
  result += "#{_indent}#{data_key}#{hash_separator}#{data_value}"
279
284
 
280
285
  unless index + 1 == x.length
281
- result += "#{@commas ? "#{comma} " : ''} \n"
286
+ show_commas = @commas && @braces
287
+ result += "#{show_commas ? "#{comma} " : ''}"
288
+ result += "\n" unless result.end_with? "\n"
282
289
  end
283
290
  end
284
291
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xprint
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.3
4
+ version: 0.9.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - JCabr
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-07-22 00:00:00.000000000 Z
11
+ date: 2020-07-26 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Gem that allows for pretty printing data over multiple lines and with
14
14
  indentation, and works with objects as well as basic data types. Also allows color,