afmenus 0.1.0 → 0.2.1

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: 2992465a91b08c0d78b26331d5d3d457d899e050ebb638b0fda690aa6c239d07
4
- data.tar.gz: d3f3ba2c57b0c4d7680682b4e5cb2b2adff6d5fbdba9c192c1dba732271a34bd
3
+ metadata.gz: 4b804d910d4f19246587aacca1dbca2a12a002b6158b1e415b4e4f30ead5f3cd
4
+ data.tar.gz: 0bb33bc1c3f1a62d2d35f79c694f2f4dc00f259b62779e1190d775e9eee46b91
5
5
  SHA512:
6
- metadata.gz: 9f40a59eba63cb43f5f733b20bd8eaa96918ceeb7e0d21b13dfc0b3f185f66406d383459ebf9bba7cc7e3a09e0ae93efc443d15650d31969b3a42b8295459701
7
- data.tar.gz: 393217ced016829403041640ca92770b6e3a1c5984dc8511d1a35a785a051da272de200a1c67bcf18d805586f340d265b480c44aa949179f8a8ccdcd99343c2c
6
+ metadata.gz: e79b6aa1efd4bbba2aff11bcfa79fed75958b5000ecfbb9d05b7373249320f60ab65d248584fe175bef2f60dfb55c8fe7a663aed789d60ad9ad56944e26c1dd9
7
+ data.tar.gz: 757c7fe8ee180ee7d18126c576cc033dd1127ee24eb74f75c83662cda3c4c807f61c54a8f55382e598f29508db484d29150318b478b4cadda6b9ff9c09eef3ea
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 UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
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 UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
14
+ gem install afmenus
21
15
  ```
22
16
 
23
17
  ## Usage
24
18
 
25
- TODO: Write usage instructions here
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/[USERNAME]/afmenus. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/afmenus/blob/master/CODE_OF_CONDUCT.md).
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).
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Afmenus
4
- VERSION = "0.1.0"
4
+ VERSION = "0.2.1"
5
5
  end
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
@@ -60,7 +61,7 @@ module Afmenus
60
61
  return nil
61
62
  end
62
63
 
63
- print_menu(menu_items, current_row, current_col)
64
+ print_menu(title, menu_items, current_row, current_col)
64
65
  end
65
66
  end
66
67
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: afmenus
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Afaq Virk