terminal-join 1.0.2 → 1.0.3
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 +4 -4
- data/CHANGELOG.md +5 -0
- data/Gemfile +2 -0
- data/lib/terminal/join/version.rb +2 -2
- data/lib/terminal/join.rb +6 -4
- data/sig/ansi_layout.rbs +6 -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: 4632ed70f1e9f11fd27622d9a3275adc5620d42feb6f756d517bf06e71450664
|
4
|
+
data.tar.gz: 9d4c892f9f18caa6169fd335fffcac2ca21c7225d101265244d36448486e3866
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 52a73493b0b3e6a07ab821cc5c475395ad4029ac80a878e2f0ad43b6e3ddde97453b01928ce1666b1c1f3aad1caf309eb8ced68f6f4e51a3f19702d22bf93122
|
7
|
+
data.tar.gz: 3e61d912fb3feaa607a270b45810bb75dfb8336fec8d9405fef166c92aeaf511b04053e23add74d7a91157e4c7fe1c246933ac5e7a18844a513f0f04c82ac2cf
|
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
data/lib/terminal/join.rb
CHANGED
@@ -6,8 +6,10 @@ require 'unicode/display_width'
|
|
6
6
|
require_relative 'join/version'
|
7
7
|
|
8
8
|
module Terminal
|
9
|
-
|
10
|
-
|
9
|
+
module Join
|
10
|
+
module_function
|
11
|
+
|
12
|
+
def style(string, *ansi, halign: :center, valign: :center, width: 0, height: 0, margin: 0)
|
11
13
|
margin = [margin, margin] unless margin.is_a?(Array)
|
12
14
|
widths = Paint.unpaint(string).lines.map { Unicode::DisplayWidth.of _1.chomp }
|
13
15
|
widths = [0] if widths.empty?
|
@@ -43,7 +45,7 @@ module Terminal
|
|
43
45
|
.join("\n")
|
44
46
|
end
|
45
47
|
|
46
|
-
def
|
48
|
+
def horizontal(*strings, separator: nil, align: :center, &block)
|
47
49
|
max_height = strings.flatten.map { _1.to_s.lines.size }.max
|
48
50
|
separator = block.call max_height if block
|
49
51
|
|
@@ -57,7 +59,7 @@ module Terminal
|
|
57
59
|
.transpose.map(&:join).join("\n")
|
58
60
|
end
|
59
61
|
|
60
|
-
def
|
62
|
+
def vertical(*strings, separator: nil, align: :center, &block)
|
61
63
|
Paint.unpaint(strings.flatten.join("\n"))
|
62
64
|
.lines.map { Unicode::DisplayWidth.of _1 }.max => max_width
|
63
65
|
separator = block.call max_width if block
|
data/sig/ansi_layout.rbs
CHANGED
@@ -1,6 +1,9 @@
|
|
1
1
|
module Terminal
|
2
|
-
|
3
|
-
|
4
|
-
|
2
|
+
module Join
|
3
|
+
def self?.style: (untyped string, *untyped ansi, ?halign: Symbol, ?valign: Symbol, ?width: Integer, ?height: Integer, ?margin: Integer) -> untyped
|
4
|
+
|
5
|
+
def self?.horizontal: (*untyped strings, ?separator: untyped?, ?align: Symbol) ?{ () -> untyped } -> untyped
|
6
|
+
|
7
|
+
def self?.vertical: (*untyped strings, ?separator: untyped?, ?align: Symbol) ?{ () -> untyped } -> untyped
|
5
8
|
end
|
6
9
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: terminal-join
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- NNB
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-08-
|
11
|
+
date: 2023-08-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: paint
|