Class: HackerToDo::Setup
- Inherits:
-
Object
- Object
- HackerToDo::Setup
- Defined in:
- lib/hacker_todo_list/setup.rb
Constant Summary collapse
- CREDENTIAL_FILE =
".hacker_todo"
Instance Attribute Summary collapse
-
#auth ⇒ Object
Returns the value of attribute auth.
Instance Method Summary collapse
-
#initialize ⇒ Setup
constructor
A new instance of Setup.
Constructor Details
#initialize ⇒ Setup
Returns a new instance of Setup.
6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/hacker_todo_list/setup.rb', line 6 def initialize if File.exist?(CREDENTIAL_FILE) @auth = YAML.load(File.read(CREDENTIAL_FILE)) else @auth = { :username => HackerToDo.get_from_console("Username:"), :password => HackerToDo.get_from_console("Password:", true) } File.write(CREDENTIAL_FILE, @auth.to_yaml) end end |
Instance Attribute Details
#auth ⇒ Object
Returns the value of attribute auth.
4 5 6 |
# File 'lib/hacker_todo_list/setup.rb', line 4 def auth @auth end |