Class: Gista::LoginPrompt
- Inherits:
-
Object
- Object
- Gista::LoginPrompt
- Defined in:
- lib/gista/login_prompt.rb
Overview
Create an object that responds to username
and password
messages by
prompting the user on the command line. Helpful when creating a
command-line client. When using as a library, simply substitute with a
Struct
or something similar.
Instance Method Summary collapse
-
#initialize ⇒ LoginPrompt
constructor
A new instance of LoginPrompt.
-
#password ⇒ String
Return the password if set, or prompt the user to enter both his username and password.
-
#username ⇒ String
Return the username if set, or prompt the user to enter both his username and password.
Constructor Details
#initialize ⇒ LoginPrompt
Returns a new instance of LoginPrompt.
16 17 18 19 |
# File 'lib/gista/login_prompt.rb', line 16 def initialize @username = nil @password = nil end |
Instance Method Details
#password ⇒ String
Return the password if set, or prompt the user to enter both his username and password.
34 35 36 37 |
# File 'lib/gista/login_prompt.rb', line 34 def password prompt unless @password @password end |
#username ⇒ String
Return the username if set, or prompt the user to enter both his username and password.
25 26 27 28 |
# File 'lib/gista/login_prompt.rb', line 25 def username prompt unless @username @username end |