class Vkontakte::AskForCredentials
Ask Email and Password for user
Attributes
email[R]
password[R]
Public Class Methods
new()
click to toggle source
# File lib/vkontakte/ask_for_credentials.rb, line 8 def initialize ask_for_credentials end
Private Instance Methods
ask()
click to toggle source
# File lib/vkontakte/ask_for_credentials.rb, line 26 def ask $stdin.gets.to_s.strip end
ask_for_credentials()
click to toggle source
# File lib/vkontakte/ask_for_credentials.rb, line 14 def ask_for_credentials puts 'Enter your credentials.' print 'Email: ' @email = ask print 'Password (typing will be hidden): ' @password = ask_for_password nil end
ask_for_password()
click to toggle source
# File lib/vkontakte/ask_for_credentials.rb, line 30 def ask_for_password echo_off password = ask puts echo_on password end
echo_off()
click to toggle source
# File lib/vkontakte/ask_for_credentials.rb, line 39 def echo_off with_tty do system 'stty -echo' end end
echo_on()
click to toggle source
# File lib/vkontakte/ask_for_credentials.rb, line 45 def echo_on with_tty do system 'stty echo' end end
with_tty() { || ... }
click to toggle source
# File lib/vkontakte/ask_for_credentials.rb, line 51 def with_tty return unless $stdin.isatty yield end