lp 0.1.2 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +8 -28
  3. data/lib/lp.rb +19 -1
  4. data/lib/lp/version.rb +1 -1
  5. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ffab20041a3abcfbd843c3898c49f8f3277d25629bfbe2f09fa4f7d626460308
4
- data.tar.gz: d4de1a0a5af03f673ad2aa0305e9d0c3658cf0ad81029be0e65e37de8245f04f
3
+ metadata.gz: a75ce9ff347cb84282f3c98aba1c75c4d085f9a4ceb936d5c5d4e36512675a28
4
+ data.tar.gz: 69d6abf21d250b3e6a4dcac9c8f68c51355bf755d2607b6918bb924895c066ee
5
5
  SHA512:
6
- metadata.gz: 746900686474347a3dc7ec1fce5c579e0b3d080aa1c4eec1be6d70d52fc8846b75c71a93330e3608c5fafd8299a7fa612fdbf581d66f3c0499323c70dd13a5b6
7
- data.tar.gz: 5663a082e1a161f510d34d141b5a622d93aced5c1cd9b5df5bb968608ddb845f2b1d7886555b081a5ede0380749ea0232ca834ca31637385883732a2e8361899
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
- Because Awesome is Annoying, and Pretty is Not.
10
+ Colorful YAML dump for debug purposes.
11
11
 
12
- This is the tinyest gem possible. It lets you print anything as YAML with:
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
- require 'lp'
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
- Why?...
27
+ Installation
45
28
  --------------------------------------------------
46
29
 
47
- - `p` is messy
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
@@ -1,3 +1,3 @@
1
1
  module LP
2
- VERSION = "0.1.2"
2
+ VERSION = "0.2.0"
3
3
  end
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.1.2
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-03-20 00:00:00.000000000 Z
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.3
41
+ rubygems_version: 3.0.4
42
42
  signing_key:
43
43
  specification_version: 4
44
44
  summary: Lovely print