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 17 |
# File 'lib/hacker_todo_list/setup.rb', line 6 def initialize credential_file_location = File.join(Dir.home, CREDENTIAL_FILE) if File.exists?(credential_file_location) @auth = YAML.load(File.read(credential_file_location)) else @auth = { :username => HackerToDo.get_from_console("Username:"), :password => HackerToDo.get_from_console("Password:", true) } File.write(credential_file_location, @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 |