lib/most_wanted/cli.rb
#User input menu/profile - Valid checke
User input menu/profile - Valid checke
User input menu / profile - Valid checke
def input_menu(topic = "main", sub_heading = nil)
          user_input = ""
          until valid_menu?(user_input, topic) do
               print "\n Type Option: ".green 
               print "  "
               user_input = gets.strip.downcase
          end
          title_goodbye if user_input == "exit"
          if user_input == 'menu'
               clear
               fbi_title
               display_main_menu
           end
          input_idx = user_input.to_i
          if input_idx > 0    
               if topic == "main"
                    topic = Api.main_topics[(input_idx - 1)].to_s
                    case input_idx
                    when 1
                         display_profile(topic,TITLES[:topten],1)
                    when 5
                         key = Api::TOPICS.key(topic)
                         display_profile(topic,TITLES[key],1)
                    else
                         display_sub_menu(topic)
                    end
               else  
                    sub_topic = Api.sub_topics(topic)[input_idx - 1]
                    display_profile(topic, TITLES[topic_key(topic)], 1, sub_topic)
               end
          end
     end
def input_menu ( topic = "main" , sub_heading = nil ) user_input = "" until valid_menu? ( user_input , topic ) do print "\n Type Option: " . green print "  " user_input = gets . strip . downcase end title_goodbye if user_input == "exit" if user_input == 'menu' clear fbi_title display_main_menu end input_idx = user_input . to_i if input_idx > 0 if topic == "main" topic = Api . main_topics [ ( input_idx - 1 ) ] . to_s case input_idx when 1 display_profile ( topic , TITLES [ :topten ] , 1 ) when 5 key = Api :: TOPICS . key ( topic ) display_profile ( topic , TITLES [ key ] , 1 ) else display_sub_menu ( topic ) end else sub_topic = Api . sub_topics ( topic ) [ input_idx - 1 ] display_profile ( topic , TITLES [ topic_key ( topic ) ] , 1 , sub_topic ) end end end
User input menu/profile - Valid checke
User input menu / profile - Valid checke
#(Loop) Valid input received #MAIN MENU / SUB-MENU INPUT (NUMBER ONLY) #sub-menu / next list (number selection)
topic
<not_specific>
sub_heading
<not_specific>