Class: Prompter
- Inherits:
-
Object
- Object
- Prompter
- Defined in:
- lib/utils/user/user.rb
Overview
Simple User Prompts
Instance Method Summary collapse
- #confirm ⇒ Object
- #create_user? ⇒ Boolean
- #delete(user) ⇒ Object
-
#initialize ⇒ Prompter
constructor
A new instance of Prompter.
- #really_sure? ⇒ Boolean
- #resume(user) ⇒ Object
- #user ⇒ Object
Constructor Details
#initialize ⇒ Prompter
Returns a new instance of Prompter.
7 8 9 |
# File 'lib/utils/user/user.rb', line 7 def initialize @prompt = TTY::Prompt.new end |
Instance Method Details
#confirm ⇒ Object
11 12 13 14 |
# File 'lib/utils/user/user.rb', line 11 def confirm exit unless @prompt.yes?('Ready to rock, Y/N?') system 'clear' end |
#create_user? ⇒ Boolean
24 25 26 |
# File 'lib/utils/user/user.rb', line 24 def create_user? @prompt.yes?('Create a new jiraQuest user?') end |
#delete(user) ⇒ Object
32 33 34 |
# File 'lib/utils/user/user.rb', line 32 def delete(user) @prompt.yes?("Would you like to delete the data for #{user}?") end |
#really_sure? ⇒ Boolean
16 17 18 |
# File 'lib/utils/user/user.rb', line 16 def really_sure? @prompt.yes?('Are you totally sure, Y/N?') end |
#resume(user) ⇒ Object
28 29 30 |
# File 'lib/utils/user/user.rb', line 28 def resume(user) @prompt.yes?("Would you like to resume jiraQuest as #{user}?") end |
#user ⇒ Object
20 21 22 |
# File 'lib/utils/user/user.rb', line 20 def user @prompt.ask('Please enter your username:') end |