make_menu 2.1.0 → 2.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8b6cd27b7d216d9aafab18ee1ada5756d4623a293bc659a6b16a01d71c95d180
4
- data.tar.gz: 48f36e38f319a452675b3c45e8189e873d4679a71a8e8867684c8494cd850fff
3
+ metadata.gz: d77eaca0e51f7d0a83a9dfee76c802001897c54ea3de35bd01dbee07e36e4f04
4
+ data.tar.gz: 4b508767ebcdd7c6de85fc90e7d596a5b0f11293c1a108c83abd819f01cda9fa
5
5
  SHA512:
6
- metadata.gz: 3a3d2c60b794b93e27dfa7de7da5fd1bf75c5b385209b5c2ee571d881824cda532a36b6b2bcdb4dddb70684dcab426ea1a0c544ff724177ff3c0b3eee13bf45d
7
- data.tar.gz: 8db18bd0530bc1118573efbe5d3df92663a8e52a9053d489118ec2ab3ceadc4f2e68427687809695de3ba0e6d41909c1f04f89feb675ca3acfae3afc96c1ca0e
6
+ metadata.gz: 6e0182748c51ea9417c65d14223ab0b558204877f2dd25cb78b9787310e8794ce972a6c04f1a4fb1aad4099fab6ca7a8dec0e4dbf8658c6113ceca972d122f9b
7
+ data.tar.gz: 8f0157fa975c994df129d9d55446c78331527d9aca1bfa3f543e99990c92186b909651f95334270ce2328585e2700d28da1988f8d41446073ce03599db17ab7b
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- make_menu (2.1.0)
4
+ make_menu (2.1.1)
5
5
  tty-screen (~> 0.8.2)
6
6
 
7
7
  GEM
@@ -2,21 +2,23 @@
2
2
 
3
3
  module MakeMenu
4
4
  module Text
5
+ SPACING = 2
6
+
5
7
  # A column of text with a fixed with
6
8
  class Column
7
- def initialize(width)
8
- @width = width
9
+ def initialize
10
+ @width = nil
9
11
  @rows = []
10
12
  @row_index = 0
11
13
  end
12
14
 
13
- attr_reader :width
14
-
15
- attr_accessor :rows, :row_index
15
+ attr_accessor :rows, :row_index, :width
16
16
 
17
17
  # Add a block of text to the column. Each row will be padded to the column width
18
18
  def add(text)
19
19
  self.rows += text.split("\n").map do |row|
20
+ self.width = row.decolor.size + SPACING unless width
21
+ self.width = [width, row.decolor.size + SPACING].max
20
22
  row.gsub("\r", '')
21
23
  end
22
24
  self.row_index += text.lines.size
@@ -64,7 +64,7 @@ module MakeMenu
64
64
 
65
65
  # Add a new column to the table
66
66
  def column_break
67
- self.current_column = Column.new(column_width)
67
+ self.current_column = Column.new
68
68
  columns << current_column
69
69
  end
70
70
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module MakeMenu
4
- VERSION = '2.1.0'
4
+ VERSION = '2.1.1'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: make_menu
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Barri Mason
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-02-07 00:00:00.000000000 Z
11
+ date: 2024-02-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: tty-screen