Class: PairUp::UI

Inherits:
Object
  • Object
show all
Defined in:
lib/pair-up/ui.rb

Class Method Summary collapse

Class Method Details

.prompt_for_pair(new_participant) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/pair-up/ui.rb', line 6

def self.prompt_for_pair(new_participant)
  highline.say("I don't know who #{new_participant} is.")
  if highline.agree("Do you want to add #{new_participant} to ~/.pair-up_pairs? (yn)")
    participant_name = highline.ask("What is #{new_participant}'s full name?").to_s
    participant_email = highline.ask("What is #{new_participant}'s email?").to_s
    PairUp::Participant.add(new_participant, participant_email, participant_name)
    PairUp::Participant.write_file
    return new_participant
  else
    highline.say("Ignoring #{new_participant}.")
  end
  return nil
end