Class: Credentials

Inherits:
Object
  • Object
show all
Defined in:
lib/subdl.rb

Instance Method Summary collapse

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

#readObject



185
186
187
# File 'lib/subdl.rb', line 185

def read
  @parsed ||= parse @file_reader.read_expand('~/.itasa-credentials')
end