Module: Morale::CredentialsStore

Includes:
IO, Platform, Storage
Included in:
Account
Defined in:
lib/morale/credentials_store.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from IO

#ask, #ask_for_secret, #ask_for_secret_on_windows, #echo_off, #echo_on, #say

Instance Attribute Details

#credentialsObject

Returns the value of attribute credentials.



11
12
13
# File 'lib/morale/credentials_store.rb', line 11

def credentials
  @credentials
end

Instance Method Details

#default_locationObject



21
22
23
# File 'lib/morale/credentials_store.rb', line 21

def default_location
  "#{home_directory}/.morale/credentials"
end

#delete_credentialsObject



34
35
36
37
# File 'lib/morale/credentials_store.rb', line 34

def delete_credentials
  self.delete
  @credentials = nil
end

#locationObject



13
14
15
# File 'lib/morale/credentials_store.rb', line 13

def location
  ENV['CREDENTIALS_LOCATION'] || default_location
end

#location=(value) ⇒ Object



17
18
19
# File 'lib/morale/credentials_store.rb', line 17

def location=(value)
  ENV['CREDENTIALS_LOCATION'] = value
end

#read_credentialsObject



25
26
27
28
# File 'lib/morale/credentials_store.rb', line 25

def read_credentials
  creds = self.read
  creds.split("\n") if creds
end

#write_credentialsObject



30
31
32
# File 'lib/morale/credentials_store.rb', line 30

def write_credentials
  self.write self.credentials
end