Class: HiCathy::CLI
- Inherits:
-
Object
- Object
- HiCathy::CLI
- Defined in:
- lib/hi_cathy/cli.rb
Instance Attribute Summary collapse
-
#pastel ⇒ Object
readonly
Returns the value of attribute pastel.
-
#prompt ⇒ Object
readonly
Returns the value of attribute prompt.
-
#sms ⇒ Object
readonly
Returns the value of attribute sms.
Instance Method Summary collapse
-
#initialize ⇒ CLI
constructor
A new instance of CLI.
- #start! ⇒ Object
Constructor Details
Instance Attribute Details
#pastel ⇒ Object (readonly)
Returns the value of attribute pastel.
12 13 14 |
# File 'lib/hi_cathy/cli.rb', line 12 def pastel @pastel end |
#prompt ⇒ Object (readonly)
Returns the value of attribute prompt.
12 13 14 |
# File 'lib/hi_cathy/cli.rb', line 12 def prompt @prompt end |
#sms ⇒ Object (readonly)
Returns the value of attribute sms.
12 13 14 |
# File 'lib/hi_cathy/cli.rb', line 12 def sms @sms end |
Instance Method Details
#start! ⇒ Object
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 68 69 70 71 72 |
# File 'lib/hi_cathy/cli.rb', line 20 def start! hero! 'Hi, Cathy!' newline! newline! say! "First things first!" say! "We can't have you forgetting my most important defining characteristic again..." newline! prompt.ask('Which country am I from?', color: :cyan) do |q| q.validate /🇨🇦/, 'Nope! P.S. the answer is an emoji 😉' end spin_for!('Analyzing answer...') { wait! } say! 'You got it!' newline! wait! say! 'Next up: dinner plans!' say! 'Our playbook this time is to check out Kuma at a slighly less peak time, and fall back to Tycoon 😋' newline! excitment = prompt.('How excited are you for this??', max: 10, default: 8) say! 'Me too!' if excitment == 10 newline! choice = prompt.select('Do any of these times work?') do || .choice 'Wednesday the 13th at 6pm' .choice 'Saturday the 16th at noon' .choice 'Nope!', :none end unless choice == :none finish! choice return end newline! say! "Oh no! We'll have to wait until I'm back from Vietnam then." say! "Let's bruteforce a date that works..." day = Date.new(2019, 11, 27) until choice != :none choice = prompt.select("Do any of these times on #{format_day(day)} work?") do || .choice "Noon" if day.saturday? || day.sunday? .choice "6pm" .choice 'Nope!', :none end day = day.next_day(1) end finish! "#{format_day(day)} at #{choice}" end |