xprint 0.9.3 → 0.9.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/version.rb +1 -1
- data/lib/xprint.rb +10 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 18c9cf643712db2a4ea35df4719149c8d768c38405112414dde3340145b7b06f
|
4
|
+
data.tar.gz: 1d7a04da4c419a33d4c913e5b55bda84505fa49470684d40faff7f6db4e4afbd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d3a7d4aa21c08354ca7435cdca38cc7aa44ae45a3090664328195b47dc6b7b7ad86016974ee1901a653b0d02339f52f103b0990a919f73e9192cafb06e2666a1
|
7
|
+
data.tar.gz: f29a49b31589be8642d0c43742612a40c5a3ab324195e06c4000b43c9a7275adfcac0dfdb3752b5f1f3834ab0562a752e11852e5a4f50a03585dfe3d3f19a8f2
|
data/lib/version.rb
CHANGED
data/lib/xprint.rb
CHANGED
@@ -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:
|
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
|
-
|
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
|
-
|
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.
|
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-
|
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,
|