Class: GoShawty::CLI
- Inherits:
-
Object
- Object
- GoShawty::CLI
- Defined in:
- lib/go_shawty/cli.rb
Instance Attribute Summary collapse
-
#day ⇒ Object
Returns the value of attribute day.
-
#month ⇒ Object
Returns the value of attribute month.
Instance Method Summary collapse
- #call ⇒ Object
- #curtis ⇒ Object
-
#curtis_bday_song ⇒ Object
–SPECIAL METHODS FOR JULY 6 BDAYS–#####.
-
#date_input ⇒ Object
–GETTING THE USER BIRTHDAY–#####.
- #feb_day_input ⇒ Object
- #generate_list ⇒ Object
-
#generate_lyric ⇒ Object
–GIVING USER A LYRIC–#####.
- #goodbye ⇒ Object
-
#list_celebrities ⇒ Object
–GIVING USER A LIST OF CELEBS–#####.
-
#more_info(selector, array) ⇒ Object
–GIVE MORE INFO ABOUT CELEB–#####.
- #thirty_day_input ⇒ Object
- #thirty_one_day_input ⇒ Object
Instance Attribute Details
#day ⇒ Object
Returns the value of attribute day.
2 3 4 |
# File 'lib/go_shawty/cli.rb', line 2 def day @day end |
#month ⇒ Object
Returns the value of attribute month.
2 3 4 |
# File 'lib/go_shawty/cli.rb', line 2 def month @month end |
Instance Method Details
#call ⇒ Object
4 5 6 7 8 9 |
# File 'lib/go_shawty/cli.rb', line 4 def call puts "\n*** A Celebrity Birthday & A Curtis Jackson Lyric ***\n\n -----What more do you need?-----\n\n" puts "Let's go, shawty, and find out who was born on ya birthday." date_input end |
#curtis ⇒ Object
182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 |
# File 'lib/go_shawty/cli.rb', line 182 def curtis puts"July 6th is the birthday of you AND..." puts " +====================+ ~MMMMMMMMMMMMMMN~ DD7IIIIIII7II?7II7+. MMMMMMMMMMMMMMMMMMMMMM ,MMMMMMMMMMMMMMMMMMMM, .+777$$7III7777777ZN$M?7I7:. MMMMMMMMMMMMMMMMMMMMMM MMMMMMMMMMMMMMMMMMMMMM~:I7777$$$$Z$77I777$M8MM$NNN7I. MMMMMMMMMMMMMMMMMMMMMM MMMMMMNMMMMMMMMMMMMMMMM+I77$$$$$$$Z888$I7MIIMM77$ZIII,. MMMMMMMMMMMMMMMMMMMMMM MMMMMMMMMMMMMMMMMMMMMMN?77$$$$$888888O888II$DMINNN77II. MMMMMMMMMM MMMMMMMMMM MMMMMMMMMNMMMMMMMMMNDDD8888O8877ZM877777II. MMMMMMMMMM MMMMMMMMMM MMMMMMMMMMMMNDDDDDDDDNMMND88$$88ZI7I77777I?. MMMMMMMMMM MMMMMMMMMM MMMMMMMMMM+IO88DDDDDD8DDMND8O?+D87I77777III. MMMMMMMMMM .MMMMMMMM. MMMMMMMMMM MMONMMMMMM,=$888DDDDDDNNDDDNMD88OOO8$777777I?. MMMMMMMMMMMMMMNMMMMMMM. MMMMMMMMMM MMMMMMMMM+:=?$ZZ8O8888DDDNNNMMND88888O77777Z7. MMMMMMMMMMMMMMMMMMMMMMM MMMMMMMMMM MMMMMMMM7IDNNDOO+?77$$OODDDDNNMMN888OO8$I7$Z+. MMMMMMMMMMMMMMMMMMMMNMM MMMMMMMMMM MMMMMMMO$8OODDDD8$$77ODDNDNDNMMMMMD88888O7ZO. MMMMMMMMMMMMMMMMMMMMMMM NNMMMMMMMM MMMMMMMM=$ZZZ78NNDD8O8DDDDOZZODMMMMD88888OI?. MMMMMMMMMM+ MMMMMMMMMM MMMMMMMMMM MMMMMMMM:7O$88ZODDO$OZ8DD$I7Z888NNMMN888O8$:. MMMMMMMMMM MMMMMMMMMM MMMMMMMM?8MDOMDOD$ZOO88Z?DNMMND8DDNMMDD88OO~. MNMMMMMMMM MMMMMMMMMM MMMMMMM$:=?$ZZOO77ZOOOOO8OD8D8D88DNNMMD888O:. .MMMMMMMM. MMMMMNMMMM MMMMMMMMMM MMMMMMM.+??7I+?7?++7O8$I$I?I7$O8DDNNMMND88Z. MMMMMMMMMM MMMMMMMMMM MMMMMMMMMM MMMMMMM+$777$NDZII$$II$I?IIII$Z88DDDDMMD8$. MMMMMMMMMM MMMMMMMMMM MMMMNMMMMM MMMMMMMI$$$$7$?DND$8N7DI?I777ZO8D888ZDNO7. MMMMMMMMMM MMMMMMMMMM MMMMMMMMMM MMMMMMMI7Z$777D8Z$O8ZZZ7?I77ZOD88OOZD$Z~. MMMMMMMMMM MMMMMMMMMM MMMMMMMMMM MMMMMMM??ZO$O87I8IDND8OZ77$7O88D88OD87D+,. MMMMMMMMMM MMMMMMMMMM MMMMMMMMMM MMMMMMM??$78$DOZZZZZZD888OZO88DD88ND$O$O~. MMMMMMMMMM MMMMMMMMMM MMMMMMMMMM MMMMMMM7IIDDNNI~=~INDO8ND8888DDDDNMDI$77.. MMMMMMMMMM MMMMMMMMMM MMMMMMMMMM MMMMMMM8IIDD$7~~::~IZ8OD8D8DDDDDMNN8?Z+... MMMMMMMMMMMMMMMMMMMMMMM +MMMMMMMMMMMMMMMMMMMD8$M8OO$7??$$OO8NDDNNNNNMMMN$7..... 8MMMMMMMMMNMMMMMNNMMMMN MMMMMMMMMMMMMMMMMNMMONND78DDDN88888DMMNNMNMMMND7O.....,. MMMMMMMMNMMMMMMMMMMMM MMMMMMMMMMMMMMMMMMMOZ$DDDDNND888D88MNNNMMMMMNO$I....... $NMMMMMMMMMNMMMMMMM MMMMMMMMMMMMMMMMMM.77NNNNDDD8DDDDNNMMMMMMMMN87$..~..... ,8DMMMNMMMMMMNMMMMMMMMMNN87.,..I . .MMMMMMMMMM. MMMMMMMM MMMMI MMM MMMMMMMMMMM. 8MMMMMMMMMMMMMMMMMMMMMMNO.,.... ...... 8MMMMMMMMMMN MMMMMMMM MMMMMI MMM MMMMMMMMMMM ,.ZMMMMMMMMMMMMMNNNMMMMM~=:,.......... MMMM MMMM MMMM MMMMMM? MMM MMMMM ,=,OMMNNMNNNNNDDDNNNMMM~,.,...I$8Z:..... MMMM MMMMMMMM MMMMMMM. MMM MMMMM ..,?,NNNNMMMNNMN8DDNDO.:7.,..,,.. ,Z7Z,..... MMMM MMMMMMMM MMMMMMMMMMMM MMMMM ...,=OMNNNNNNMNDD7....:I,,,.:,=.....,:,...:+.. MMMM MMMM MMMM`MMMMMMM MMMMM ..?7NNNNNNND.......~I,,,,..,,,...,.......?=. MMMM MMMM MMMM MMMM `MMMMMM MMMMM ...=?DDD8,.. .....:.+,,,,.,,....,:........7:.. 8MMMMMMMMMMN MMMMMMMM MMMM MMMMM MMMMM .....:.............,,.7,,,,..,.................... MMMMMMMMMM MMMMMMMM MMMM MMMM MMMMM .....:,.. ......,,..,,7.,,,........................ ....,.:........,...,:.+,,,............................ .:.,.=:...........,=~7.,............:..........,...... .......,..,:...........,,7I,..............,......,,.,....... .....,,..:I...........,~?,,,,.............,....,...:........" puts "\n...and if you need to know who else..." generate_list end |
#curtis_bday_song ⇒ Object
–SPECIAL METHODS FOR JULY 6 BDAYS–#####
173 174 175 176 177 178 179 180 |
# File 'lib/go_shawty/cli.rb', line 173 def curtis_bday_song da_club = Nokogiri::HTML(open("http://www.allthelyrics.com/lyrics/50_cent/in_da_club_radio_edit-lyrics-899426.html")) sing_along = da_club.css("div.content-text-inner p").text puts "\n\nYou have the birthday of all birthdays. You share a birthday with Curtis Jackson. So sing with me now..." puts"--------------------------------------------------------------------------------------------------------------------" puts "#{sing_along}" curtis end |
#date_input ⇒ Object
–GETTING THE USER BIRTHDAY–#####
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/go_shawty/cli.rb', line 13 def date_input puts "\n** In what month were you born? (1-12)\n" puts "1. Jan 7. Jul" puts "2. Feb 8. Aug" puts "3. Mar 9. Sept" puts "4. Apr 10. Oct" puts "5. May 11. Nov" puts "6. June 12. Dec" input = gets.strip case input when "1" @month = "january" thirty_one_day_input when "2" @month = "february" feb_day_input when "3" @month = "march" thirty_one_day_input when "4" @month = "april" thirty_day_input when "5" @month = "may" thirty_one_day_input when "6" @month = "june" thirty_day_input when "7" @month = "july" thirty_one_day_input when "8" @month = "august" thirty_one_day_input when "9" @month = "september" thirty_day_input when "10" @month = "october" thirty_one_day_input when "11" @month = "november" thirty_day_input when "12" @month = "december" thirty_one_day_input when "exit" goodbye else puts "Say what now?" date_input end end |
#feb_day_input ⇒ Object
93 94 95 96 97 98 99 100 101 102 103 |
# File 'lib/go_shawty/cli.rb', line 93 def feb_day_input puts "\n** Sweet. What day? (1-29)" input = gets.to_i if input < 30 && input > 0 @day = input.to_s generate_lyric else puts "Can you do that again for me?" feb_day_input end end |
#generate_list ⇒ Object
127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 |
# File 'lib/go_shawty/cli.rb', line 127 def generate_list array = GoShawty::CelebrityScraper.scrape_bday_page(month, day) counter = 1 array.each do |i| puts "#{counter}. #{i[:name]} born in #{i[:year]} - #{i[:desc]}\n" counter += 1 end puts "\n** Select the number of any person you'd like to learn more about, or you can pick a (D)ifferent date, or you can (E)xit and head to da club." input = gets.strip if /d/i === input self.date_input elsif /e/i === input goodbye elsif input.to_i <= array.length more_info(input.to_i, array) else goodbye end end |
#generate_lyric ⇒ Object
–GIVING USER A LYRIC–#####
107 108 109 110 111 112 113 114 115 116 117 118 |
# File 'lib/go_shawty/cli.rb', line 107 def generate_lyric if month == "july" && day == "6" curtis_bday_song else puts "\nOkay. Here's your 50 Cent Lyric that will guide you in your celebration:\n*****pretend he wrote it just for you*****" bday_lyric = GoShawty::Lyric.new puts"Song: #{bday_lyric.song_name}\n" puts "#{bday_lyric.album_name}\n" puts "\n\n#{bday_lyric.lines}\n" list_celebrities end end |
#goodbye ⇒ Object
232 233 234 |
# File 'lib/go_shawty/cli.rb', line 232 def goodbye puts"Aight. C-ya at da club." end |
#list_celebrities ⇒ Object
–GIVING USER A LIST OF CELEBS–#####
122 123 124 125 |
# File 'lib/go_shawty/cli.rb', line 122 def list_celebrities puts "\nAnd here are the celebrities who share your birthday! Celebrate together! Sing the lyric TOGETHER!!!\n" generate_list end |
#more_info(selector, array) ⇒ Object
–GIVE MORE INFO ABOUT CELEB–#####
149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 |
# File 'lib/go_shawty/cli.rb', line 149 def more_info(selector, array) target_celeb_url = array[selector-1][:info_link] know_more = GoShawty::CelebrityMaker.scrape_celeb_page(target_celeb_url) puts "#{know_more.age}\n#{know_more.born}\n#{know_more.died}\n#{know_more.birthplace}" puts "\n\n" puts "#{know_more.bio}\n" puts "\n** Do you want to know more about another (P)erson who shares this birthday, check on a (D)ifferent birthday, or (E)xit?" input = gets.strip if /p/i === input list_celebrities elsif /d/i === input self.date_input else goodbye end end |
#thirty_day_input ⇒ Object
81 82 83 84 85 86 87 88 89 90 91 |
# File 'lib/go_shawty/cli.rb', line 81 def thirty_day_input puts "\n** Sweet. What day? (1-30)" input = gets.to_i if input <31 && input > 0 @day = input.to_s generate_lyric else puts "Can you do that again for me?" thirty_day_input end end |
#thirty_one_day_input ⇒ Object
69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/go_shawty/cli.rb', line 69 def thirty_one_day_input puts "\n** Sweet. What day? (1-31)" input = gets.to_i if input < 32 && input > 0 @day = input.to_s generate_lyric else puts "Can you do that again for me?" thirty_one_day_input end end |