Module: AbideDevUtils::Prompt
- Defined in:
- lib/abide_dev_utils/prompt.rb
Class Method Summary collapse
- .password ⇒ Object
- .secure(msg) ⇒ Object
- .single_line(msg) ⇒ Object
- .username ⇒ Object
- .yes_no(msg) ⇒ Object
Class Method Details
.password ⇒ Object
24 25 26 |
# File 'lib/abide_dev_utils/prompt.rb', line 24 def self.password $stdin.getpass('Password:') end |
.secure(msg) ⇒ Object
28 29 30 |
# File 'lib/abide_dev_utils/prompt.rb', line 28 def self.secure(msg) $stdin.getpass(msg) end |
.single_line(msg) ⇒ Object
14 15 16 17 |
# File 'lib/abide_dev_utils/prompt.rb', line 14 def self.single_line(msg) print "#{msg}: " $stdin.cooked(&:gets).chomp end |
.username ⇒ Object
19 20 21 22 |
# File 'lib/abide_dev_utils/prompt.rb', line 19 def self.username print 'Username: ' $stdin.cooked(&:gets).chomp end |
.yes_no(msg) ⇒ Object
7 8 9 10 11 12 |
# File 'lib/abide_dev_utils/prompt.rb', line 7 def self.yes_no(msg) print "#{msg} (Y/n): " return true if $stdin.cooked(&:gets).match?(/^[Yy].*/) false end |