ex_aequo_base 0.1.3 → 0.1.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.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2f42430967e4c2f9e06b956df55783e74a92a1e820d226b580517f21f50c00e2
|
4
|
+
data.tar.gz: fb27b96a0dcabf3730527c162013114a465c00ac4a369595c25ac17fc9d032ad
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 84104dce64e79d0fe8945d1aeaac2f63bbb14329933eb4e9f84aefbfae68f2b842c9c0de5c82dca1c1c1cfddc3d2060dd532f7d03001efeffe5d3625b15b8a23
|
7
|
+
data.tar.gz: ce17b03ae58f71e3b0d9c2c45d9c7e55a32b1ad7788f1c31163f4fd263879c340a1a6558495026060caf950dcf0a394eb43ccef3b1112f1164165e8b3a241343
|
@@ -25,22 +25,22 @@ module ExAequo
|
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
28
|
-
def colorize_file(file, reset: false)
|
28
|
+
def colorize_file(file, device: $stdout, reset: false)
|
29
29
|
file = File.open(file, 'r') if String === file
|
30
30
|
|
31
31
|
at_exit do
|
32
32
|
file.close rescue nil
|
33
33
|
end
|
34
|
-
colorize_lines( file.readlines(chomp: true) )
|
34
|
+
colorize_lines( file.readlines(chomp: true), device:, reset: )
|
35
35
|
end
|
36
36
|
|
37
|
-
def colorize_lines(lines, reset: false)
|
37
|
+
def colorize_lines(lines, reset: false, device: $stdout)
|
38
38
|
lines = lines.split(%r{\n\r?}) if String === lines
|
39
39
|
lines
|
40
40
|
.each_with_index do | line, idx |
|
41
41
|
case colorize(line, reset:)
|
42
42
|
in {ok: true, result:}
|
43
|
-
puts result
|
43
|
+
device.puts result
|
44
44
|
in {ok: false, error:}
|
45
45
|
$stderr.puts("ERROR in line #{idx.succ} ** #{error} **")
|
46
46
|
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative '../colorize/colorizer'
|
4
|
+
class String
|
5
|
+
def colored(color, reset: true)
|
6
|
+
colors = [color, self, (reset ? :reset : nil)].compact
|
7
|
+
Colorize::Colorizer.colored(*colors)
|
8
|
+
end
|
9
|
+
|
10
|
+
def pcolored(color, device: $stdout) = Colorize::Colorizer.pcolored(color, self, device:)
|
11
|
+
end
|
12
|
+
# SPDX-License-Identifier: AGPL-3.0-or-later
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ex_aequo_base
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robert Dober
|
@@ -68,6 +68,7 @@ files:
|
|
68
68
|
- lib/ex_aequo/base/kernel.rb
|
69
69
|
- lib/ex_aequo/base/match_data.rb
|
70
70
|
- lib/ex_aequo/base/open_struct.rb
|
71
|
+
- lib/ex_aequo/base/string/colorize.rb
|
71
72
|
- lib/ex_aequo/base/version.rb
|
72
73
|
homepage: https://codeberg.org/lab419/rb_ex_aequo_base
|
73
74
|
licenses:
|