class GetToWork::MenuPresenter

Public Class Methods

new(options) click to toggle source
# File lib/get_to_work/menu_presenter.rb, line 7
def initialize(options)
  @options = options
end
with_collection(options) click to toggle source
# File lib/get_to_work/menu_presenter.rb, line 3
def self.with_collection(options)
  new(options)
end

Public Instance Methods

item_for(choice:) click to toggle source
# File lib/get_to_work/menu_presenter.rb, line 17
def item_for(choice:)
  index = choice.to_i - 1
  @options[index]
end
menu_limit() click to toggle source
table() click to toggle source
# 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