Class: Credentials
- Inherits:
-
Object
- Object
- Credentials
- Defined in:
- lib/subdl.rb
Instance Method Summary collapse
-
#initialize(file_reader) ⇒ Credentials
constructor
A new instance of Credentials.
- #parse(file_contents) ⇒ Object
- #read ⇒ Object
Constructor Details
#initialize(file_reader) ⇒ Credentials
Returns a new instance of Credentials.
176 177 178 |
# File 'lib/subdl.rb', line 176 def initialize file_reader @file_reader = file_reader end |
Instance Method Details
#parse(file_contents) ⇒ Object
179 180 181 182 183 184 |
# File 'lib/subdl.rb', line 179 def parse file_contents lines = file_contents.lines.to_a username = lines[0].chomp password = lines[1].chomp [username, password] end |
#read ⇒ Object
185 186 187 |
# File 'lib/subdl.rb', line 185 def read @parsed ||= parse @file_reader.('~/.itasa-credentials') end |