lib/redmine_cli/helpers/input.rb
#
# prints names as enumerable list and asks user for element
#
prints names as enumerable list and asks user for element
prints names as enumerable list and asks user for element
def ask_for_object(object_list)
        fail EmptyList if object_list.size.zero?
        i = 0
        object_list = object_list.map { |obj| [(i += 1), obj] }.to_h
        print_object_list(object_list)
        puts
        input = ask m(:select_item_from_list),
                    default: '1',
                    limited_to: ->(str) { (1..i).cover? str.to_i }
        object_list[input.to_i]
      end
def ask_for_object ( object_list ) fail EmptyList if object_list . size . zero? i = 0 object_list = object_list . map { | obj | [ ( i += 1 ) , obj ] } . to_h print_object_list ( object_list ) puts input = ask m ( :select_item_from_list ) , default : '1' , limited_to : -> ( str ) { ( 1 .. i ) . cover? str . to_i } object_list [ input . to_i ] end
prints names as enumerable list and asks user for element
prints names as enumerable list and asks user for element
# From 1
object_list