class MartialArts::CLI
CLI
Controler
Public Instance Methods
call()
click to toggle source
# File lib/martial_arts/cli.rb, line 4 def call messages("greeting") menu end
display_info_for(style)
click to toggle source
# File lib/martial_arts/cli.rb, line 342 def display_info_for(style) puts " " puts " #{"Style info for".magenta} #{style.name.cyan}" puts " " puts "Country: #{style.country_name.green}" puts "Fighting Focus: #{style.fighting_focus_name.yellow}" puts " " puts "Description: #{style.description.red}" puts " " puts "More Info: #{style.website.magenta}" puts " " end
messages(type)
click to toggle source
# File lib/martial_arts/cli.rb, line 279 def messages(type) case type when "greeting" puts "OOOOOOSSSsss".magenta puts "Choose your destiny".blue #maybe want to add delay from first puts to second, maybe 3 seconds. when "invalid" puts "" puts "I'm confused can you try that again?".cyan puts "" when "user" puts "" puts "Enter the corresponding number for more information".light_cyan puts "#{"Otherwise type".cyan} list #{"or".cyan} back" when "styles by focus" puts "" puts " #{"FIGHTING FOCUS:".magenta} #{@focus_list[@focus_input.to_i]}" puts "" when "fighting focus menu" puts "" puts " CHOOSE YOUR FIGHTING FOCUS".magenta puts "" when "all styles" puts "" puts " #{"ALL STYLES".magenta}" puts "" when "styles by country" puts "" puts " #{"MARTIAL ARTS FROM".magenta} #{@country.upcase.cyan}" puts "" when "countries" puts "" puts " #{"COUNTRIES".magenta}" puts "" when "popular" puts "" puts " POPULAR MARTIAL ARTS".magenta#15 tabs for title puts "" when "list or back" puts "#{"Type".cyan} list #{"or".cyan} back" else end end
popular_list()
click to toggle source
# File lib/martial_arts/cli.rb, line 84 def popular_list messages("popular") MartialArts::Styles.popular.each.with_index(1) do |style_instance, i| puts "#{i}. #{style_instance.name}" if style_instance.class == MartialArts::Styles puts "#{i}. #{style_instance}" if style_instance.class == String #This could be removed if it is performed along with the scrape end messages("user") end
styles_by_country_list(input)
click to toggle source
# File lib/martial_arts/cli.rb, line 162 def styles_by_country_list(input) @country_input = input @country = MartialArts::Countries.country_list[input.to_i-1] @style_list = MartialArts::Styles.search_by_country(@country) messages("styles by country") @style_list.each.with_index(1) {|style_instance, i| puts "#{i}. #{style_instance.name}"} messages("user") end
styles_by_focus_list(input)
click to toggle source
# File lib/martial_arts/cli.rb, line 269 def styles_by_focus_list(input) @focus_input = input #save input from focus_submenu so user can return @focus_style_list = MartialArts::Styles.search_by_focus(@focus_list[input.to_i]) messages("styles by focus") @focus_style_list.each.with_index(1) {|style_instance, i| puts "#{i}. #{style_instance.name}" } messages("user") end