Class: Gloo::WebSvr::Config
- Inherits:
-
Object
- Object
- Gloo::WebSvr::Config
- Defined in:
- lib/gloo/web_svr/config.rb
Constant Summary collapse
- SCHEME_SEPARATOR =
'://'
- HTTP =
'http'
- HTTPS =
'https'
- LOCALHOST =
'localhost'
- PORT_DEFAULT =
'8080'
Instance Attribute Summary collapse
-
#host ⇒ Object
readonly
Returns the value of attribute host.
-
#port ⇒ Object
readonly
Returns the value of attribute port.
-
#scheme ⇒ Object
readonly
Returns the value of attribute scheme.
Instance Method Summary collapse
-
#base_url ⇒ Object
The base url, including scheme, host and port.
-
#initialize(scheme = HTTP, host = LOCALHOST, port = PORT_DEFAULT) ⇒ Config
constructor
Set up the web server.
Constructor Details
#initialize(scheme = HTTP, host = LOCALHOST, port = PORT_DEFAULT) ⇒ Config
Set up the web server.
27 28 29 30 31 |
# File 'lib/gloo/web_svr/config.rb', line 27 def initialize( scheme = HTTP, host = LOCALHOST, port = PORT_DEFAULT ) @scheme = scheme @host = host @port = port end |
Instance Attribute Details
#host ⇒ Object (readonly)
Returns the value of attribute host.
17 18 19 |
# File 'lib/gloo/web_svr/config.rb', line 17 def host @host end |
#port ⇒ Object (readonly)
Returns the value of attribute port.
17 18 19 |
# File 'lib/gloo/web_svr/config.rb', line 17 def port @port end |
#scheme ⇒ Object (readonly)
Returns the value of attribute scheme.
17 18 19 |
# File 'lib/gloo/web_svr/config.rb', line 17 def scheme @scheme end |
Instance Method Details
#base_url ⇒ Object
The base url, including scheme, host and port.
46 47 48 49 50 51 52 |
# File 'lib/gloo/web_svr/config.rb', line 46 def base_url url = "#{self.scheme}#{SCHEME_SEPARATOR}#{self.host}" unless self.port.blank? url << ":#{self.port}" end return url end |