Class: Contentful::Bootstrap::Server
- Inherits:
-
Object
- Object
- Contentful::Bootstrap::Server
- Defined in:
- lib/contentful/bootstrap/server.rb
Instance Attribute Summary collapse
-
#server ⇒ Object
readonly
Returns the value of attribute server.
Instance Method Summary collapse
-
#initialize(token) ⇒ Server
constructor
A new instance of Server.
- #running? ⇒ Boolean
- #start ⇒ Object
- #stop ⇒ Object
Constructor Details
#initialize(token) ⇒ Server
Returns a new instance of Server.
85 86 87 88 89 90 |
# File 'lib/contentful/bootstrap/server.rb', line 85 def initialize(token) @server = WEBrick::HTTPServer.new(Port: 5123) @server.mount '/', IndexController @server.mount '/oauth_callback', OAuthCallbackController @server.mount '/save_token', SaveTokenController, token end |
Instance Attribute Details
#server ⇒ Object (readonly)
Returns the value of attribute server.
83 84 85 |
# File 'lib/contentful/bootstrap/server.rb', line 83 def server @server end |
Instance Method Details
#running? ⇒ Boolean
100 101 102 |
# File 'lib/contentful/bootstrap/server.rb', line 100 def running? @server.status != :Stop end |
#start ⇒ Object
92 93 94 |
# File 'lib/contentful/bootstrap/server.rb', line 92 def start Thread.new { @server.start } end |
#stop ⇒ Object
96 97 98 |
# File 'lib/contentful/bootstrap/server.rb', line 96 def stop @server.shutdown end |