Class: Gloo::WebSvr::Config

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

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

#hostObject (readonly)

Returns the value of attribute host.



17
18
19
# File 'lib/gloo/web_svr/config.rb', line 17

def host
  @host
end

#portObject (readonly)

Returns the value of attribute port.



17
18
19
# File 'lib/gloo/web_svr/config.rb', line 17

def port
  @port
end

#schemeObject (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_urlObject

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