lp 0.1.2 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +8 -28
- data/lib/lp.rb +19 -1
- data/lib/lp/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a75ce9ff347cb84282f3c98aba1c75c4d085f9a4ceb936d5c5d4e36512675a28
|
4
|
+
data.tar.gz: 69d6abf21d250b3e6a4dcac9c8f68c51355bf755d2607b6918bb924895c066ee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7be1d23d0d55d95e68fc6929d12fc9037ce3e2c1ae5572ed9e178d9c9f633ea4646586266e70356bf9a49e6f81f6d09f5cc9233fc8908f812827b10c56e1026b
|
7
|
+
data.tar.gz: 298dd25f357220d62d78ebcc10c08369192705205e3eb1f112f5aeecf8a5816a6c751786e1faeea0b308c280ce8316aa0ed473ff0df814a566833bc046a712c4
|
data/README.md
CHANGED
@@ -7,45 +7,25 @@ Lovely Print
|
|
7
7
|
|
8
8
|
---
|
9
9
|
|
10
|
-
|
10
|
+
Colorful YAML dump for debug purposes.
|
11
11
|
|
12
|
-
|
12
|
+
Print a colorful YAML output:
|
13
13
|
|
14
14
|
```ruby
|
15
15
|
lp your_object
|
16
16
|
```
|
17
17
|
|
18
|
-
|
19
|
-
|
20
|
-
Installation
|
21
|
-
--------------------------------------------------
|
22
|
-
|
23
|
-
$ gem install lp
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
Usage
|
28
|
-
--------------------------------------------------
|
18
|
+
Print a plain YAML output:
|
29
19
|
|
30
20
|
```ruby
|
31
|
-
|
32
|
-
|
33
|
-
anything = { ace: 'ventura', like: ['a', 'glove'] }
|
34
|
-
lp anything
|
35
|
-
# =>
|
36
|
-
# ---
|
37
|
-
# :ace: ventura
|
38
|
-
# :like:
|
39
|
-
# - a
|
40
|
-
# - glove
|
21
|
+
lp your_object
|
22
|
+
# same as: puts your_object.to_yaml
|
41
23
|
```
|
42
24
|
|
25
|
+
---
|
43
26
|
|
44
|
-
|
27
|
+
Installation
|
45
28
|
--------------------------------------------------
|
46
29
|
|
47
|
-
|
48
|
-
- `pp` is messy
|
49
|
-
- `ap` is colorful and messy
|
50
|
-
- why not
|
30
|
+
$ gem install lp
|
51
31
|
|
data/lib/lp.rb
CHANGED
@@ -1,5 +1,23 @@
|
|
1
1
|
require 'yaml'
|
2
2
|
|
3
|
-
def lp(anything)
|
3
|
+
def lp!(anything)
|
4
4
|
puts anything.to_yaml
|
5
|
+
end
|
6
|
+
|
7
|
+
def lp(anything)
|
8
|
+
reset = "\e[0m"
|
9
|
+
red = "\e[31m"
|
10
|
+
green = "\e[32m"
|
11
|
+
yellow = "\e[33m"
|
12
|
+
blue = "\e[34m"
|
13
|
+
magenta = "\e[35m"
|
14
|
+
cyan = "\e[36m"
|
15
|
+
|
16
|
+
result = anything.to_yaml
|
17
|
+
|
18
|
+
result.gsub! /!ruby\/object:/, "#{blue}>>> #{reset}"
|
19
|
+
result.gsub! /([\s\-]*:?.*?:)(.*)/, green + '\1' + reset + '\2'
|
20
|
+
result.gsub! /([&*]\d+)/, red + '\1' + reset
|
21
|
+
|
22
|
+
puts result
|
5
23
|
end
|
data/lib/lp/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Danny Ben Shitrit
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-09-10 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Lovely print
|
14
14
|
email: db@dannyben.com
|
@@ -38,7 +38,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
38
38
|
- !ruby/object:Gem::Version
|
39
39
|
version: '0'
|
40
40
|
requirements: []
|
41
|
-
rubygems_version: 3.0.
|
41
|
+
rubygems_version: 3.0.4
|
42
42
|
signing_key:
|
43
43
|
specification_version: 4
|
44
44
|
summary: Lovely print
|