afmenus 0.1.0 → 0.2.0
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/README.md +8 -14
- data/lib/afmenus/version.rb +1 -1
- data/lib/afmenus.rb +4 -3
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f6b1dd0eaedf59b665e7cca8fa85ddbcb8777a855ae7abaf87c8620a048ea3e9
|
4
|
+
data.tar.gz: 565e2a7a73083f4226138775624a1538c782899b0d44567e5108d33d9a743e77
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8081431f0d36949a8507de7bb088c5c047da100d36c71f8d0de2495ac81020bcb61a519f8bfe7701c0ef492aff782049c507635f31f17e31009bc3a0a519ae3d
|
7
|
+
data.tar.gz: 37e984f041c7d084a79ae688f001084054edc46f73410632b58009ec2dc80f6c3ed84ffb5cde2409fb5a2ed76aa9a25fe160d3017bb07776df9593e105cbf896
|
data/README.md
CHANGED
@@ -1,28 +1,26 @@
|
|
1
1
|
# Afmenus
|
2
2
|
|
3
|
-
TODO: Delete this and the text below, and describe your gem
|
4
|
-
|
5
|
-
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/afmenus`. To experiment with that code, run `bin/console` for an interactive prompt.
|
6
|
-
|
7
3
|
## Installation
|
8
4
|
|
9
|
-
TODO: Replace `UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG` with your gem name right after releasing it to RubyGems.org. Please do not do it earlier due to security reasons. Alternatively, replace this section with instructions to install your gem from git if you don't plan to release to RubyGems.org.
|
10
|
-
|
11
5
|
Install the gem and add to the application's Gemfile by executing:
|
12
6
|
|
13
7
|
```bash
|
14
|
-
bundle add
|
8
|
+
bundle add afmenus
|
15
9
|
```
|
16
10
|
|
17
11
|
If bundler is not being used to manage dependencies, install the gem by executing:
|
18
12
|
|
19
13
|
```bash
|
20
|
-
gem install
|
14
|
+
gem install afmenus
|
21
15
|
```
|
22
16
|
|
23
17
|
## Usage
|
24
18
|
|
25
|
-
|
19
|
+
Hello World:
|
20
|
+
|
21
|
+
```
|
22
|
+
Afmenus.prompt([["y", "n", "exit"]])
|
23
|
+
```
|
26
24
|
|
27
25
|
## Development
|
28
26
|
|
@@ -32,12 +30,8 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
32
30
|
|
33
31
|
## Contributing
|
34
32
|
|
35
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
33
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/afaqmvirk/afmenus.
|
36
34
|
|
37
35
|
## License
|
38
36
|
|
39
37
|
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
40
|
-
|
41
|
-
## Code of Conduct
|
42
|
-
|
43
|
-
Everyone interacting in the Afmenus project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/afmenus/blob/master/CODE_OF_CONDUCT.md).
|
data/lib/afmenus/version.rb
CHANGED
data/lib/afmenus.rb
CHANGED
@@ -12,8 +12,9 @@ module Afmenus
|
|
12
12
|
end
|
13
13
|
|
14
14
|
# Print the menu with the current selection highlighted
|
15
|
-
def self.print_menu(menu_items, current_row, current_col)
|
15
|
+
def self.print_menu(title , menu_items, current_row, current_col)
|
16
16
|
clear_console
|
17
|
+
puts title
|
17
18
|
menu_items.each_with_index do |row_items, row|
|
18
19
|
row_items.each_with_index do |item, col|
|
19
20
|
if row == current_row && col == current_col
|
@@ -29,11 +30,11 @@ module Afmenus
|
|
29
30
|
end
|
30
31
|
|
31
32
|
# Prompt the user with the menu
|
32
|
-
def self.prompt(menu_items)
|
33
|
+
def self.prompt(title, menu_items)
|
33
34
|
current_row = 0
|
34
35
|
current_col = 0
|
35
36
|
|
36
|
-
print_menu(menu_items, current_row, current_col)
|
37
|
+
print_menu(title, menu_items, current_row, current_col)
|
37
38
|
|
38
39
|
loop do
|
39
40
|
char = STDIN.getch
|