Class: DailyTrending::Cli
- Inherits:
-
Object
- Object
- DailyTrending::Cli
- Defined in:
- lib/daily_trending/cli.rb
Instance Method Summary collapse
Instance Method Details
#app_info(app) ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/daily_trending/cli.rb', line 42 def app_info(app) app.make_app(app.app_url) puts " \#{app.title.upcase.colorize(:blue)}\n Developers: \#{app.dev}\n Content For: \#{app.con_rating}\n Rated By: \#{app.rate_cnt}\n\n DOC\n puts \"DESCRIPTION:\".colorize(:red)\n puts <<-DOC\n\n \#{app.description}\n\n Get App At: \#{app.app_url.colorize(:red)}\n More Apps By \#{app.dev}: \#{app.dev_url.colorize(:red)}\n\n DOC\nend\n" |
#call ⇒ Object
3 4 5 6 7 |
# File 'lib/daily_trending/cli.rb', line 3 def call list_apps goodbye end |
#goodbye ⇒ Object
63 64 65 |
# File 'lib/daily_trending/cli.rb', line 63 def goodbye puts "See you next time!!" end |
#list_apps ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/daily_trending/cli.rb', line 9 def list_apps s = "******".colorize(:blue) puts "" puts " #{s}"+"New And Updated Apps!"+s puts "" @apps = DailyTrending::App.make_apps @apps.each.with_index(1) do |app, i| puts " \#{i} \#{app.title.colorize(:blue)}\n \#{app.rating} Cost: \#{app.price}\n\n DOC\n end\n puts \"\"\nend\n" |
#menu ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/daily_trending/cli.rb', line 26 def input = nil until input == 'exit' puts "Enter the number of the app that interests you or type exit" input = gets.strip.downcase if input.to_i > 0 app_info(@apps[input.to_i-1]) elsif input == 'list' list_apps else puts "#{input} not an option, type list or exit" unless input == 'exit' end end end |