Class: Slipcover::Server
- Inherits:
-
Struct
- Object
- Struct
- Slipcover::Server
- Defined in:
- lib/slipcover/server.rb
Instance Attribute Summary collapse
-
#key ⇒ Object
Returns the value of attribute key.
-
#path ⇒ Object
Returns the value of attribute path.
Instance Method Summary collapse
- #config ⇒ Object
- #host ⇒ Object
- #password ⇒ Object
- #port ⇒ Object
- #server_configs ⇒ Object
- #url ⇒ Object
- #user_info ⇒ Object
-
#username ⇒ Object
We’re interpolating this because Ruby freezes double hash reference strings.
Instance Attribute Details
#key ⇒ Object
Returns the value of attribute key
3 4 5 |
# File 'lib/slipcover/server.rb', line 3 def key @key end |
#path ⇒ Object
Returns the value of attribute path
3 4 5 |
# File 'lib/slipcover/server.rb', line 3 def path @path end |
Instance Method Details
#config ⇒ Object
8 9 10 |
# File 'lib/slipcover/server.rb', line 8 def config @config ||= server_configs[key] end |
#host ⇒ Object
23 24 25 |
# File 'lib/slipcover/server.rb', line 23 def host config['host'] end |
#password ⇒ Object
36 37 38 |
# File 'lib/slipcover/server.rb', line 36 def password config['couch_password_key'] ? "#{ENV[config['couch_password_key']]}" : "" end |
#port ⇒ Object
27 28 29 |
# File 'lib/slipcover/server.rb', line 27 def port config['port'] ? ":#{config['port']}" : '' end |
#server_configs ⇒ Object
4 5 6 |
# File 'lib/slipcover/server.rb', line 4 def server_configs YAML.load(File.read(path)) end |
#url ⇒ Object
12 13 14 |
# File 'lib/slipcover/server.rb', line 12 def url "#{user_info}#{host}#{port}" end |
#user_info ⇒ Object
16 17 18 19 20 21 |
# File 'lib/slipcover/server.rb', line 16 def user_info info = "" + username info << ":#{password}" unless info.empty? info << "@" unless info.empty? info end |
#username ⇒ Object
We’re interpolating this because Ruby freezes double hash reference strings
32 33 34 |
# File 'lib/slipcover/server.rb', line 32 def username config['couch_username_key'] ? "#{ENV[config['couch_username_key']]}" : "" end |