Class: Hitch::UI

Inherits:
Object
  • Object
show all
Defined in:
lib/hitch/ui.rb

Class Method Summary collapse

Class Method Details

.prompt_for_group_emailObject



6
7
8
9
10
11
# File 'lib/hitch/ui.rb', line 6

def self.prompt_for_group_email
  Hitch.group_email = highline.ask("What is the group email? e.g. [email protected] will become [email protected]") do |q|
    q.case = :down
    q.validate = /\A[a-zA-Z0-9_\.\-]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-\.]+\z/
  end.to_s
end

.prompt_for_pair(new_author) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/hitch/ui.rb', line 13

def self.prompt_for_pair(new_author)
  highline.say("I don't know who #{new_author} is.")
  if highline.agree("Do you want to add #{new_author} to ~/.hitch_pairs?")
    author_name = highline.ask("What is #{new_author}'s full name?").to_s
    Hitch::Author.add(new_author, author_name)
    Hitch::Author.write_file
    return new_author
  else
    highline.say("Ignoring #{new_author}.")
  end
  return nil
end