eitil 1.3.1 → 1.3.2
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c476bec69197002e34513b633e1cdadbb8498c8c3dc25cf50bbde796ea6e2991
|
4
|
+
data.tar.gz: 43703b8c42157e5ab27933eb4779c3e6d9b5a34896d528d337678669730d3d09
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 61bb9bbb7d03844ec0b7dd6061e1000665cc6a7997ed0312bbe6e65ad7b71adc696bd86534b8002f36a061fb6d0ef1567fafb8e508a4001463784aa4f442a763
|
7
|
+
data.tar.gz: d315eec8ad4a9deeced007e60c63e7f31239b7993e4d2e7eeb4cf2289a40b5d1fb01bdf26695e2b8c80373a336493facb6ef0656e33e62fddfdcfa9b7600d93a
|
data/eitil_core/README.md
CHANGED
@@ -495,6 +495,37 @@ require "eitil_core/string"
|
|
495
495
|
|
496
496
|
```
|
497
497
|
|
498
|
+
```ruby
|
499
|
+
# require "eitil_core/string/colorize"
|
500
|
+
|
501
|
+
# formats strings, so that they are styled when printed to the terminal.
|
502
|
+
|
503
|
+
'hi'.black
|
504
|
+
'hi'.red
|
505
|
+
'hi'.green
|
506
|
+
'hi'.brown
|
507
|
+
'hi'.blue
|
508
|
+
'hi'.magenta
|
509
|
+
'hi'.cyan
|
510
|
+
'hi'.gray
|
511
|
+
|
512
|
+
'hi'.bg_black
|
513
|
+
'hi'.bg_red
|
514
|
+
'hi'.bg_green
|
515
|
+
'hi'.bg_brown
|
516
|
+
'hi'.bg_blue
|
517
|
+
'hi'.bg_magenta
|
518
|
+
'hi'.bg_cyan
|
519
|
+
'hi'.bg_gray
|
520
|
+
|
521
|
+
'hi'.bold
|
522
|
+
'hi'.italic
|
523
|
+
'hi'.underline
|
524
|
+
'hi'.blink
|
525
|
+
'hi'.reverse_color
|
526
|
+
|
527
|
+
```
|
528
|
+
|
498
529
|
```ruby
|
499
530
|
# require "eitil_core/string/strip_base64_header"
|
500
531
|
|
@@ -0,0 +1,30 @@
|
|
1
|
+
|
2
|
+
# require "eitil_core/string/colorize"
|
3
|
+
|
4
|
+
class String
|
5
|
+
|
6
|
+
def black; "\e[30m#{self}\e[0m" end
|
7
|
+
def red; "\e[31m#{self}\e[0m" end
|
8
|
+
def green; "\e[32m#{self}\e[0m" end
|
9
|
+
def brown; "\e[33m#{self}\e[0m" end
|
10
|
+
def blue; "\e[34m#{self}\e[0m" end
|
11
|
+
def magenta; "\e[35m#{self}\e[0m" end
|
12
|
+
def cyan; "\e[36m#{self}\e[0m" end
|
13
|
+
def gray; "\e[37m#{self}\e[0m" end
|
14
|
+
|
15
|
+
def bg_black; "\e[40m#{self}\e[0m" end
|
16
|
+
def bg_red; "\e[41m#{self}\e[0m" end
|
17
|
+
def bg_green; "\e[42m#{self}\e[0m" end
|
18
|
+
def bg_brown; "\e[43m#{self}\e[0m" end
|
19
|
+
def bg_blue; "\e[44m#{self}\e[0m" end
|
20
|
+
def bg_magenta; "\e[45m#{self}\e[0m" end
|
21
|
+
def bg_cyan; "\e[46m#{self}\e[0m" end
|
22
|
+
def bg_gray; "\e[47m#{self}\e[0m" end
|
23
|
+
|
24
|
+
def bold; "\e[1m#{self}\e[22m" end
|
25
|
+
def italic; "\e[3m#{self}\e[23m" end
|
26
|
+
def underline; "\e[4m#{self}\e[24m" end
|
27
|
+
def blink; "\e[5m#{self}\e[25m" end
|
28
|
+
def reverse_color; "\e[7m#{self}\e[27m" end
|
29
|
+
|
30
|
+
end
|
data/lib/eitil/version.rb
CHANGED
Binary file
|
@@ -0,0 +1,91 @@
|
|
1
|
+
RSpec.describe "EitilCore String colorize methods" do
|
2
|
+
|
3
|
+
it "should not crash when multiple colors are chained" do
|
4
|
+
expect("hello world".black.blue.red.bg_green.bg_brown.underline.bold).to be_truthy
|
5
|
+
end
|
6
|
+
|
7
|
+
it "should color on .black" do
|
8
|
+
expect("hello world".black).to be_truthy
|
9
|
+
end
|
10
|
+
|
11
|
+
it "should color on .red" do
|
12
|
+
expect("hello world".red).to be_truthy
|
13
|
+
end
|
14
|
+
|
15
|
+
it "should color on .green" do
|
16
|
+
expect("hello world".green).to be_truthy
|
17
|
+
end
|
18
|
+
|
19
|
+
it "should color on .brown" do
|
20
|
+
expect("hello world".brown).to be_truthy
|
21
|
+
end
|
22
|
+
|
23
|
+
it "should color on .blue" do
|
24
|
+
expect("hello world".blue).to be_truthy
|
25
|
+
end
|
26
|
+
|
27
|
+
it "should color on .magenta" do
|
28
|
+
expect("hello world".magenta).to be_truthy
|
29
|
+
end
|
30
|
+
|
31
|
+
it "should color on .cyan" do
|
32
|
+
expect("hello world".cyan).to be_truthy
|
33
|
+
end
|
34
|
+
|
35
|
+
it "should color on .gray" do
|
36
|
+
expect("hello world".gray).to be_truthy
|
37
|
+
end
|
38
|
+
|
39
|
+
it "should color on .bg_black" do
|
40
|
+
expect("hello world".bg_black).to be_truthy
|
41
|
+
end
|
42
|
+
|
43
|
+
it "should color on .bg_red" do
|
44
|
+
expect("hello world".bg_red).to be_truthy
|
45
|
+
end
|
46
|
+
|
47
|
+
it "should color on .bg_green" do
|
48
|
+
expect("hello world".bg_green).to be_truthy
|
49
|
+
end
|
50
|
+
|
51
|
+
it "should color on .bg_brown" do
|
52
|
+
expect("hello world".bg_brown).to be_truthy
|
53
|
+
end
|
54
|
+
|
55
|
+
it "should color on .bg_blue" do
|
56
|
+
expect("hello world".bg_blue).to be_truthy
|
57
|
+
end
|
58
|
+
|
59
|
+
it "should color on .bg_magenta" do
|
60
|
+
expect("hello world".bg_magenta).to be_truthy
|
61
|
+
end
|
62
|
+
|
63
|
+
it "should color on .bg_cyan" do
|
64
|
+
expect("hello world".bg_cyan).to be_truthy
|
65
|
+
end
|
66
|
+
|
67
|
+
it "should color on .bg_gray" do
|
68
|
+
expect("hello world".bg_gray).to be_truthy
|
69
|
+
end
|
70
|
+
|
71
|
+
it "should color on .bold" do
|
72
|
+
expect("hello world".bold).to be_truthy
|
73
|
+
end
|
74
|
+
|
75
|
+
it "should color on .italic" do
|
76
|
+
expect("hello world".italic).to be_truthy
|
77
|
+
end
|
78
|
+
|
79
|
+
it "should color on .underline" do
|
80
|
+
expect("hello world".underline).to be_truthy
|
81
|
+
end
|
82
|
+
|
83
|
+
it "should color on .blink" do
|
84
|
+
expect("hello world".blink).to be_truthy
|
85
|
+
end
|
86
|
+
|
87
|
+
it "should color on .reverse_color" do
|
88
|
+
expect("hello world".reverse_color).to be_truthy
|
89
|
+
end
|
90
|
+
|
91
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: eitil
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jurriaan Schrofer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-09-
|
11
|
+
date: 2021-09-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -221,6 +221,7 @@ files:
|
|
221
221
|
- eitil_core/lib/eitil_core/setters.rb
|
222
222
|
- eitil_core/lib/eitil_core/setters/set_ivars.rb
|
223
223
|
- eitil_core/lib/eitil_core/string.rb
|
224
|
+
- eitil_core/lib/eitil_core/string/colorize.rb
|
224
225
|
- eitil_core/lib/eitil_core/string/strip_base64_header.rb
|
225
226
|
- eitil_core/lib/eitil_core/string/to_filename.rb
|
226
227
|
- eitil_core/lib/eitil_core/type_checkers.rb
|
@@ -431,6 +432,7 @@ files:
|
|
431
432
|
- spec/eitil_core/safe_executions/safe_call.rb
|
432
433
|
- spec/eitil_core/safe_executions/safe_send.rb
|
433
434
|
- spec/eitil_core/setters/set_ivars_spec.rb
|
435
|
+
- spec/eitil_core/string/colorize_spec.rb
|
434
436
|
- spec/eitil_core/string/strip_base64_header_spec.rb
|
435
437
|
- spec/eitil_core/string/to_filename_spec.rb
|
436
438
|
- spec/eitil_core/type_checkers/is_num_or_nan_spec.rb
|