Class: GetToWork::MenuPresenter
- Inherits:
-
Object
- Object
- GetToWork::MenuPresenter
- Defined in:
- lib/get_to_work/menu_presenter.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(options) ⇒ MenuPresenter
constructor
A new instance of MenuPresenter.
- #item_for(choice:) ⇒ Object
- #menu_limit ⇒ Object
- #table ⇒ Object
Constructor Details
#initialize(options) ⇒ MenuPresenter
Returns a new instance of MenuPresenter.
7 8 9 |
# File 'lib/get_to_work/menu_presenter.rb', line 7 def initialize() @options = end |
Class Method Details
.with_collection(options) ⇒ Object
3 4 5 |
# File 'lib/get_to_work/menu_presenter.rb', line 3 def self.with_collection() new() end |
Instance Method Details
#item_for(choice:) ⇒ Object
17 18 19 20 |
# File 'lib/get_to_work/menu_presenter.rb', line 17 def item_for(choice:) index = choice.to_i - 1 @options[index] end |
#menu_limit ⇒ Object
22 23 24 |
# File 'lib/get_to_work/menu_presenter.rb', line 22 def (1..@options.count).map(&:to_s) end |
#table ⇒ Object
11 12 13 14 15 |
# File 'lib/get_to_work/menu_presenter.rb', line 11 def table @options.map.with_index do |option, i| [i + 1, option.name] end end |