Module: Morale::ConnectionStore
Instance Method Summary
collapse
Methods included from Platform
#home_directory, #running_on_windows?
Methods included from Storage
#delete, #read, #write
Instance Method Details
#base_url ⇒ Object
9
10
11
12
13
14
15
16
17
18
|
# File 'lib/morale/connection_store.rb', line 9
def base_url
if @base_url.nil?
@base_url = read_connection
if @base_url.nil?
@base_url = default_base_url
self.write_connection
end
end
@base_url
end
|
#base_url=(value) ⇒ Object
20
21
22
23
|
# File 'lib/morale/connection_store.rb', line 20
def base_url=(value)
@base_url = value
self.write_connection
end
|
#default_location ⇒ Object
33
34
35
|
# File 'lib/morale/connection_store.rb', line 33
def default_location
"#{home_directory}/.morale/connection"
end
|
#delete_connection ⇒ Object
37
38
39
40
|
# File 'lib/morale/connection_store.rb', line 37
def delete_connection
self.delete
@base_url = nil
end
|
#location ⇒ Object
25
26
27
|
# File 'lib/morale/connection_store.rb', line 25
def location
ENV['CONNECTION_LOCATION'] || default_location
end
|
#location=(value) ⇒ Object
29
30
31
|
# File 'lib/morale/connection_store.rb', line 29
def location=(value)
ENV['CONNECTION_LOCATION'] = value
end
|
#read_connection ⇒ Object
42
43
44
45
|
# File 'lib/morale/connection_store.rb', line 42
def read_connection
connection = self.read
connection.split("\n")[0] if connection
end
|
#write_connection ⇒ Object
47
48
49
|
# File 'lib/morale/connection_store.rb', line 47
def write_connection
self.write self.base_url
end
|