curses_menu 0.0.1 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +28 -0
- data/LICENSE.md +31 -0
- data/README.md +78 -0
- data/examples/actions.rb +25 -25
- data/examples/automatic_key_presses.rb +49 -49
- data/examples/formatting.rb +148 -130
- data/examples/hello.rb +8 -8
- data/examples/refresh.rb +22 -22
- data/examples/scrolling.rb +9 -9
- data/examples/several_items.rb +18 -18
- data/examples/sub_menus.rb +20 -20
- data/examples/utf_8.rb +8 -0
- data/lib/curses_menu.rb +248 -241
- data/lib/curses_menu/curses_row.rb +151 -150
- data/lib/curses_menu/version.rb +5 -0
- data/spec/curses_menu_test.rb +131 -0
- data/spec/curses_menu_test/actions_spec.rb +221 -0
- data/spec/curses_menu_test/formatting_spec.rb +411 -0
- data/spec/curses_menu_test/rubocop_spec.rb +31 -0
- data/spec/curses_menu_test/scrolling_spec.rb +95 -0
- data/spec/curses_menu_test/simple_navigation_spec.rb +123 -0
- data/spec/spec_helper.rb +105 -0
- metadata +89 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d07858a5e2aad9b9633584a1e0b2c06b9a13ad5b69752ef7b4808ed614e7a889
|
4
|
+
data.tar.gz: 65f6f0b04deea7b529d136fe6fa3fea72fcfc98cfc0fc8d651863814a4bde162
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f322978d91a509bf1696d1da056f65a7dc097bf65e61ebf46194c1bc555dad59caadadd8cca9f2c5b8bf4aea87a0d086a22555b8084e06c6a15c56c5a9ccd3f3
|
7
|
+
data.tar.gz: 744ed073c7e764068f3b97a528255371b70dedd99c1d164e4cc2f8981069dfd8e1ec5c606df74f3b4df00c232d3995cd31037c53401fc7bc092b1e6313da596a
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# [v0.0.5](https://github.com/Muriel-Salvan/curses_menu/compare/v0.0.4...v0.0.5) (2021-08-18 11:48:24)
|
2
|
+
|
3
|
+
### Patches
|
4
|
+
|
5
|
+
* [[Hotfix] Add Windows support](https://github.com/Muriel-Salvan/curses_menu/commit/b47b51a79988363c0e292987fe4a97dd6f05c6d8)
|
6
|
+
|
7
|
+
# [v0.0.4](https://github.com/Muriel-Salvan/curses_menu/compare/v0.0.3...v0.0.4) (2021-08-18 10:25:59)
|
8
|
+
|
9
|
+
### Patches
|
10
|
+
|
11
|
+
* [Test UTF-8 support](https://github.com/Muriel-Salvan/curses_menu/commit/f94129db540d41f17f0ed46563461601f140029f)
|
12
|
+
|
13
|
+
# [v0.0.3](https://github.com/Muriel-Salvan/curses_menu/compare/v0.0.2...v0.0.3) (2021-08-15 16:16:16)
|
14
|
+
|
15
|
+
### Patches
|
16
|
+
|
17
|
+
* [Add the spec direcotry in the gem as it contains files that can be useful to users](https://github.com/Muriel-Salvan/curses_menu/commit/aeb73ea4507029be97dba2d8243fa3e33ac151ba)
|
18
|
+
|
19
|
+
# [v0.0.2](https://github.com/Muriel-Salvan/curses_menu/compare/v0.0.1...v0.0.2) (2021-08-15 15:24:19)
|
20
|
+
|
21
|
+
### Patches
|
22
|
+
|
23
|
+
* [Added colors testing + Proper CI/CD + Ruby 3 compatibility](https://github.com/Muriel-Salvan/curses_menu/commit/035b19fc27a61c9d10c6b5517993dd0f54537eec)
|
24
|
+
* [Add white colors](https://github.com/Muriel-Salvan/curses_menu/commit/5adf552c01f7a254621e53ecd45e04e9c2358bb8)
|
25
|
+
|
26
|
+
# 0.0.1
|
27
|
+
|
28
|
+
* Initial version
|
data/LICENSE.md
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
|
2
|
+
The license stated herein is a copy of the BSD License (modified on July 1999).
|
3
|
+
The AUTHOR mentionned below refers to the list of people involved in the
|
4
|
+
creation and modification of any file included in the delivered package.
|
5
|
+
This list is found in the file named AUTHORS.
|
6
|
+
The AUTHORS and LICENSE files have to be included in any release of software
|
7
|
+
embedding source code of this package, or using it as a derivative software.
|
8
|
+
|
9
|
+
Copyright (c) 2019 - 2019 Muriel Salvan (muriel@x-aeon.com)
|
10
|
+
|
11
|
+
Redistribution and use in source and binary forms, with or without
|
12
|
+
modification, are permitted provided that the following conditions are met:
|
13
|
+
|
14
|
+
1. Redistributions of source code must retain the above copyright notice,
|
15
|
+
this list of conditions and the following disclaimer.
|
16
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
17
|
+
this list of conditions and the following disclaimer in the documentation
|
18
|
+
and/or other materials provided with the distribution.
|
19
|
+
3. The name of the author may not be used to endorse or promote products
|
20
|
+
derived from this software without specific prior written permission.
|
21
|
+
|
22
|
+
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
23
|
+
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
24
|
+
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
25
|
+
EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
26
|
+
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
27
|
+
OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
28
|
+
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
29
|
+
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
30
|
+
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
31
|
+
OF SUCH DAMAGE.
|
data/README.md
ADDED
@@ -0,0 +1,78 @@
|
|
1
|
+
# curses_menu
|
2
|
+
|
3
|
+
Ruby API to create terminal-based menus, using [curses][link-curses].
|
4
|
+
|
5
|
+
* Easy navigation using arrows, page up/down, home, end, enter and escape keys.
|
6
|
+
* Several actions per menu item.
|
7
|
+
* Scrolling support.
|
8
|
+
* Extensive formatting options with colors, alignments, decorations...
|
9
|
+
* Easy support for sub-menus.
|
10
|
+
* Automatic key presses for autmating tasks in the menu.
|
11
|
+
* Ruby-like API.
|
12
|
+
|
13
|
+
## Install
|
14
|
+
|
15
|
+
Via gem
|
16
|
+
|
17
|
+
``` bash
|
18
|
+
$ gem install curses_menu
|
19
|
+
```
|
20
|
+
|
21
|
+
Via a Gemfile
|
22
|
+
|
23
|
+
``` ruby
|
24
|
+
$ gem 'curses_menu'
|
25
|
+
```
|
26
|
+
|
27
|
+
## Usage
|
28
|
+
|
29
|
+
``` ruby
|
30
|
+
require 'curses_menu'
|
31
|
+
|
32
|
+
CursesMenu.new 'My awesome new menu!' do |menu|
|
33
|
+
menu.item 'How\'s life?' do
|
34
|
+
puts 'Couldn\'t be easier'
|
35
|
+
:menu_exit
|
36
|
+
end
|
37
|
+
end
|
38
|
+
```
|
39
|
+
|
40
|
+
Check the [examples][link-examples] folder for more examples.
|
41
|
+
|
42
|
+
## Change log
|
43
|
+
|
44
|
+
Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.
|
45
|
+
|
46
|
+
## Testing
|
47
|
+
|
48
|
+
Automated tests are done using rspec.
|
49
|
+
|
50
|
+
Do execute them, first install development dependencies:
|
51
|
+
|
52
|
+
```bash
|
53
|
+
bundle install
|
54
|
+
```
|
55
|
+
|
56
|
+
Then execute rspec
|
57
|
+
|
58
|
+
```bash
|
59
|
+
bundle exec rspec
|
60
|
+
```
|
61
|
+
|
62
|
+
## Contributing
|
63
|
+
|
64
|
+
Any contribution is welcome:
|
65
|
+
* Fork the github project and create pull requests.
|
66
|
+
* Report bugs by creating tickets.
|
67
|
+
* Suggest improvements and new features by creating tickets.
|
68
|
+
|
69
|
+
## Credits
|
70
|
+
|
71
|
+
- [Muriel Salvan][link-author]
|
72
|
+
|
73
|
+
## License
|
74
|
+
|
75
|
+
The BSD License. Please see [License File](LICENSE.md) for more information.
|
76
|
+
|
77
|
+
[link-curses]: https://rubygems.org/gems/curses/versions/1.2.4
|
78
|
+
[link-examples]: ./examples
|
data/examples/actions.rb
CHANGED
@@ -1,25 +1,25 @@
|
|
1
|
-
require 'curses_menu'
|
2
|
-
|
3
|
-
nbr = 0
|
4
|
-
CursesMenu.new 'Items can have several actions. Look at the footer!' do |menu|
|
5
|
-
menu.item "Current number is #{nbr} - Use a or d", actions: {
|
6
|
-
'd' => {
|
7
|
-
name: 'Increase',
|
8
|
-
execute: proc do
|
9
|
-
nbr += 1
|
10
|
-
:menu_refresh
|
11
|
-
end
|
12
|
-
},
|
13
|
-
'a' => {
|
14
|
-
name: 'Decrease',
|
15
|
-
execute: proc do
|
16
|
-
nbr -= 1
|
17
|
-
:menu_refresh
|
18
|
-
end
|
19
|
-
}
|
20
|
-
}
|
21
|
-
menu.item 'Quit' do
|
22
|
-
puts 'Quitting...'
|
23
|
-
:menu_exit
|
24
|
-
end
|
25
|
-
end
|
1
|
+
require 'curses_menu'
|
2
|
+
|
3
|
+
nbr = 0
|
4
|
+
CursesMenu.new 'Items can have several actions. Look at the footer!' do |menu|
|
5
|
+
menu.item "Current number is #{nbr} - Use a or d", actions: {
|
6
|
+
'd' => {
|
7
|
+
name: 'Increase',
|
8
|
+
execute: proc do
|
9
|
+
nbr += 1
|
10
|
+
:menu_refresh
|
11
|
+
end
|
12
|
+
},
|
13
|
+
'a' => {
|
14
|
+
name: 'Decrease',
|
15
|
+
execute: proc do
|
16
|
+
nbr -= 1
|
17
|
+
:menu_refresh
|
18
|
+
end
|
19
|
+
}
|
20
|
+
}
|
21
|
+
menu.item 'Quit' do
|
22
|
+
puts 'Quitting...'
|
23
|
+
:menu_exit
|
24
|
+
end
|
25
|
+
end
|
@@ -1,49 +1,49 @@
|
|
1
|
-
require 'curses_menu'
|
2
|
-
|
3
|
-
keys = [
|
4
|
-
# Select first
|
5
|
-
CursesMenu::KEY_ENTER,
|
6
|
-
# Select second
|
7
|
-
Curses::KEY_DOWN,
|
8
|
-
'a',
|
9
|
-
'b',
|
10
|
-
# Select third (sub-menu)
|
11
|
-
Curses::KEY_DOWN,
|
12
|
-
CursesMenu::KEY_ENTER,
|
13
|
-
# Select sub-menu first
|
14
|
-
CursesMenu::KEY_ENTER,
|
15
|
-
# Exit sub-menu
|
16
|
-
CursesMenu::KEY_ESCAPE,
|
17
|
-
# Navigate a bit
|
18
|
-
Curses::KEY_NPAGE,
|
19
|
-
Curses::KEY_HOME,
|
20
|
-
# Select last
|
21
|
-
Curses::KEY_END,
|
22
|
-
CursesMenu::KEY_ENTER
|
23
|
-
]
|
24
|
-
CursesMenu.new('Menu being used automatically', key_presses: keys) do |menu|
|
25
|
-
menu.item 'Simple item' do
|
26
|
-
puts 'Selected a simple item'
|
27
|
-
end
|
28
|
-
menu.item 'Several actions on this item', actions: {
|
29
|
-
'a' => {
|
30
|
-
name: 'Action A',
|
31
|
-
execute: proc { puts 'Selected action A' }
|
32
|
-
},
|
33
|
-
'b' => {
|
34
|
-
name: 'Action B',
|
35
|
-
execute: proc { puts 'Selected action B' }
|
36
|
-
}
|
37
|
-
}
|
38
|
-
menu.item 'Sub-menu' do
|
39
|
-
CursesMenu.new('Sub-menu!', key_presses: keys) do |sub_menu|
|
40
|
-
sub_menu.item 'Simple sub-menu item' do
|
41
|
-
puts 'Selected item from sub-menu'
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
45
|
-
menu.item 'Quit' do
|
46
|
-
puts 'Quitting...'
|
47
|
-
:menu_exit
|
48
|
-
end
|
49
|
-
end
|
1
|
+
require 'curses_menu'
|
2
|
+
|
3
|
+
keys = [
|
4
|
+
# Select first
|
5
|
+
CursesMenu::KEY_ENTER,
|
6
|
+
# Select second
|
7
|
+
Curses::KEY_DOWN,
|
8
|
+
'a',
|
9
|
+
'b',
|
10
|
+
# Select third (sub-menu)
|
11
|
+
Curses::KEY_DOWN,
|
12
|
+
CursesMenu::KEY_ENTER,
|
13
|
+
# Select sub-menu first
|
14
|
+
CursesMenu::KEY_ENTER,
|
15
|
+
# Exit sub-menu
|
16
|
+
CursesMenu::KEY_ESCAPE,
|
17
|
+
# Navigate a bit
|
18
|
+
Curses::KEY_NPAGE,
|
19
|
+
Curses::KEY_HOME,
|
20
|
+
# Select last
|
21
|
+
Curses::KEY_END,
|
22
|
+
CursesMenu::KEY_ENTER
|
23
|
+
]
|
24
|
+
CursesMenu.new('Menu being used automatically', key_presses: keys) do |menu|
|
25
|
+
menu.item 'Simple item' do
|
26
|
+
puts 'Selected a simple item'
|
27
|
+
end
|
28
|
+
menu.item 'Several actions on this item', actions: {
|
29
|
+
'a' => {
|
30
|
+
name: 'Action A',
|
31
|
+
execute: proc { puts 'Selected action A' }
|
32
|
+
},
|
33
|
+
'b' => {
|
34
|
+
name: 'Action B',
|
35
|
+
execute: proc { puts 'Selected action B' }
|
36
|
+
}
|
37
|
+
}
|
38
|
+
menu.item 'Sub-menu' do
|
39
|
+
CursesMenu.new('Sub-menu!', key_presses: keys) do |sub_menu|
|
40
|
+
sub_menu.item 'Simple sub-menu item' do
|
41
|
+
puts 'Selected item from sub-menu'
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
menu.item 'Quit' do
|
46
|
+
puts 'Quitting...'
|
47
|
+
:menu_exit
|
48
|
+
end
|
49
|
+
end
|
data/examples/formatting.rb
CHANGED
@@ -1,130 +1,148 @@
|
|
1
|
-
require 'curses_menu'
|
2
|
-
|
3
|
-
dynamic_row_1 = CursesMenu::CursesRow.new(
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
}
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
text: '
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
1
|
+
require 'curses_menu'
|
2
|
+
|
3
|
+
dynamic_row_1 = CursesMenu::CursesRow.new(
|
4
|
+
{
|
5
|
+
first_cell: { text: 'Select to' },
|
6
|
+
second_cell: {
|
7
|
+
text: 'change the',
|
8
|
+
color_pair: CursesMenu::COLORS_GREEN
|
9
|
+
},
|
10
|
+
third_cell: {
|
11
|
+
text: 'cells order',
|
12
|
+
color_pair: CursesMenu::COLORS_RED
|
13
|
+
}
|
14
|
+
}
|
15
|
+
)
|
16
|
+
dynamic_row_2 = CursesMenu::CursesRow.new(
|
17
|
+
{
|
18
|
+
first_cell: { text: 'Select to change' },
|
19
|
+
second_cell: {
|
20
|
+
text: 'the cells properties',
|
21
|
+
color_pair: CursesMenu::COLORS_GREEN,
|
22
|
+
fixed_size: 40
|
23
|
+
}
|
24
|
+
}
|
25
|
+
)
|
26
|
+
CursesMenu.new 'Extended formatting available too!' do |menu|
|
27
|
+
menu.item CursesMenu::CursesRow.new(
|
28
|
+
{
|
29
|
+
default_cell: {
|
30
|
+
text: 'Simple color change - GREEN!',
|
31
|
+
color_pair: CursesMenu::COLORS_GREEN
|
32
|
+
}
|
33
|
+
}
|
34
|
+
)
|
35
|
+
menu.item CursesMenu::CursesRow.new(
|
36
|
+
{
|
37
|
+
green_cell: {
|
38
|
+
text: 'Several cells ',
|
39
|
+
color_pair: CursesMenu::COLORS_GREEN
|
40
|
+
},
|
41
|
+
red_cell: {
|
42
|
+
text: 'with different ',
|
43
|
+
color_pair: CursesMenu::COLORS_RED
|
44
|
+
},
|
45
|
+
blue_cell: {
|
46
|
+
text: 'formatting',
|
47
|
+
color_pair: CursesMenu::COLORS_BLUE
|
48
|
+
}
|
49
|
+
}
|
50
|
+
)
|
51
|
+
menu.item CursesMenu::CursesRow.new(
|
52
|
+
{
|
53
|
+
default_cell: {
|
54
|
+
text: 'Use prefixes and suffixes',
|
55
|
+
begin_with: '[ ',
|
56
|
+
end_with: ' ]'
|
57
|
+
}
|
58
|
+
}
|
59
|
+
)
|
60
|
+
menu.item CursesMenu::CursesRow.new(
|
61
|
+
{
|
62
|
+
first_cell: {
|
63
|
+
text: 'This will have a fixed size!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!',
|
64
|
+
begin_with: '[ ',
|
65
|
+
end_with: ' ]',
|
66
|
+
fixed_size: 40
|
67
|
+
},
|
68
|
+
second_cell: {
|
69
|
+
text: 'And other cells will be aligned',
|
70
|
+
color_pair: CursesMenu::COLORS_GREEN
|
71
|
+
}
|
72
|
+
}
|
73
|
+
)
|
74
|
+
menu.item CursesMenu::CursesRow.new(
|
75
|
+
{
|
76
|
+
first_cell: {
|
77
|
+
text: 'Pretty nice',
|
78
|
+
fixed_size: 40
|
79
|
+
},
|
80
|
+
second_cell: {
|
81
|
+
text: 'for alignment',
|
82
|
+
color_pair: CursesMenu::COLORS_GREEN
|
83
|
+
}
|
84
|
+
}
|
85
|
+
)
|
86
|
+
menu.item CursesMenu::CursesRow.new(
|
87
|
+
{
|
88
|
+
first_cell: {
|
89
|
+
text: 'And you can justify',
|
90
|
+
justify: :right,
|
91
|
+
fixed_size: 40
|
92
|
+
},
|
93
|
+
second_cell: {
|
94
|
+
text: 'your text when size is fixed!',
|
95
|
+
justify: :left,
|
96
|
+
color_pair: CursesMenu::COLORS_GREEN
|
97
|
+
}
|
98
|
+
}
|
99
|
+
)
|
100
|
+
menu.item CursesMenu::CursesRow.new(
|
101
|
+
{
|
102
|
+
first_cell: {
|
103
|
+
text: 'You can even',
|
104
|
+
justify: :right,
|
105
|
+
fixed_size: 40,
|
106
|
+
pad: '_-'
|
107
|
+
},
|
108
|
+
second_cell: {
|
109
|
+
text: 'pad it!',
|
110
|
+
justify: :left,
|
111
|
+
color_pair: CursesMenu::COLORS_GREEN,
|
112
|
+
fixed_size: 40,
|
113
|
+
pad: '*'
|
114
|
+
}
|
115
|
+
}
|
116
|
+
)
|
117
|
+
menu.item CursesMenu::CursesRow.new(
|
118
|
+
{
|
119
|
+
first_cell: { text: 'Use a' },
|
120
|
+
second_cell: {
|
121
|
+
text: 'different separator',
|
122
|
+
color_pair: CursesMenu::COLORS_GREEN
|
123
|
+
},
|
124
|
+
third_cell: { text: 'between cells' }
|
125
|
+
},
|
126
|
+
separator: '|'
|
127
|
+
)
|
128
|
+
menu.item dynamic_row_1 do
|
129
|
+
dynamic_row_1.cells_order(%i[first_cell second_cell third_cell].sort_by { rand })
|
130
|
+
:menu_refresh
|
131
|
+
end
|
132
|
+
menu.item dynamic_row_2 do
|
133
|
+
dynamic_row_2.change_cells(
|
134
|
+
first_cell: {
|
135
|
+
color_pair: [CursesMenu::COLORS_GREEN, CursesMenu::COLORS_RED, CursesMenu::COLORS_BLUE].sample
|
136
|
+
},
|
137
|
+
second_cell: {
|
138
|
+
color_pair: [CursesMenu::COLORS_GREEN, CursesMenu::COLORS_RED, CursesMenu::COLORS_BLUE].sample,
|
139
|
+
pad: ['*', ' ', '|', '='].sample
|
140
|
+
}
|
141
|
+
)
|
142
|
+
:menu_refresh
|
143
|
+
end
|
144
|
+
menu.item 'Quit' do
|
145
|
+
puts 'Quitting...'
|
146
|
+
:menu_exit
|
147
|
+
end
|
148
|
+
end
|