Class: Rockbox::Configuration
- Inherits:
-
Object
- Object
- Rockbox::Configuration
- Defined in:
- lib/rockbox/configuration.rb
Overview
Mutable configuration holder used by the builder block API.
Constant Summary collapse
- DEFAULT_HOST =
"localhost"- DEFAULT_PORT =
6062
Instance Attribute Summary collapse
-
#host ⇒ Object
Returns the value of attribute host.
-
#http_url ⇒ Object
Returns the value of attribute http_url.
-
#open_timeout ⇒ Object
Returns the value of attribute open_timeout.
-
#port ⇒ Object
Returns the value of attribute port.
-
#read_timeout ⇒ Object
Returns the value of attribute read_timeout.
-
#ws_url ⇒ Object
Returns the value of attribute ws_url.
Instance Method Summary collapse
-
#initialize(host: nil, port: nil, http_url: nil, ws_url: nil, open_timeout: nil, read_timeout: nil) ⇒ Configuration
constructor
A new instance of Configuration.
- #resolved_host ⇒ Object
- #resolved_http_url ⇒ Object
- #resolved_port ⇒ Object
- #resolved_ws_url ⇒ Object
Constructor Details
#initialize(host: nil, port: nil, http_url: nil, ws_url: nil, open_timeout: nil, read_timeout: nil) ⇒ Configuration
Returns a new instance of Configuration.
17 18 19 20 21 22 23 24 25 |
# File 'lib/rockbox/configuration.rb', line 17 def initialize(host: nil, port: nil, http_url: nil, ws_url: nil, open_timeout: nil, read_timeout: nil) @host = host @port = port @http_url = http_url @ws_url = ws_url @open_timeout = open_timeout @read_timeout = read_timeout end |
Instance Attribute Details
#host ⇒ Object
Returns the value of attribute host.
15 16 17 |
# File 'lib/rockbox/configuration.rb', line 15 def host @host end |
#http_url ⇒ Object
Returns the value of attribute http_url.
15 16 17 |
# File 'lib/rockbox/configuration.rb', line 15 def http_url @http_url end |
#open_timeout ⇒ Object
Returns the value of attribute open_timeout.
15 16 17 |
# File 'lib/rockbox/configuration.rb', line 15 def open_timeout @open_timeout end |
#port ⇒ Object
Returns the value of attribute port.
15 16 17 |
# File 'lib/rockbox/configuration.rb', line 15 def port @port end |
#read_timeout ⇒ Object
Returns the value of attribute read_timeout.
15 16 17 |
# File 'lib/rockbox/configuration.rb', line 15 def read_timeout @read_timeout end |
#ws_url ⇒ Object
Returns the value of attribute ws_url.
15 16 17 |
# File 'lib/rockbox/configuration.rb', line 15 def ws_url @ws_url end |
Instance Method Details
#resolved_host ⇒ Object
27 |
# File 'lib/rockbox/configuration.rb', line 27 def resolved_host; @host || DEFAULT_HOST end |
#resolved_http_url ⇒ Object
30 31 32 |
# File 'lib/rockbox/configuration.rb', line 30 def resolved_http_url @http_url || "http://#{resolved_host}:#{resolved_port}/graphql" end |
#resolved_port ⇒ Object
28 |
# File 'lib/rockbox/configuration.rb', line 28 def resolved_port; @port || DEFAULT_PORT end |
#resolved_ws_url ⇒ Object
34 35 36 |
# File 'lib/rockbox/configuration.rb', line 34 def resolved_ws_url @ws_url || "ws://#{resolved_host}:#{resolved_port}/graphql" end |