Class: Woodhouse::Server
- Inherits:
-
Object
- Object
- Woodhouse::Server
- Includes:
- Celluloid, Util
- Defined in:
- lib/woodhouse/server.rb
Instance Attribute Summary (collapse)
-
- (Object) configuration
Returns the value of attribute configuration.
-
- (Object) layout
Returns the value of attribute layout.
-
- (Object) node
Returns the value of attribute node.
Instance Method Summary (collapse)
-
- (Server) initialize(keyw = {})
constructor
A new instance of Server.
- - (Boolean) ready_to_start?
- - (Object) reload
-
- (Object) shutdown
TODO: do this better.
- - (Object) start
Constructor Details
- (Server) initialize(keyw = {})
A new instance of Server
12 13 14 15 16 |
# File 'lib/woodhouse/server.rb', line 12 def initialize(keyw = {}) self.layout = keyw[:layout] self.node = keyw[:node] self.configuration = keyw[:configuration] || Woodhouse.global_configuration end |
Instance Attribute Details
- (Object) configuration
Returns the value of attribute configuration
8 9 10 |
# File 'lib/woodhouse/server.rb', line 8 def configuration @configuration end |
- (Object) layout
Returns the value of attribute layout
7 8 9 |
# File 'lib/woodhouse/server.rb', line 7 def layout @layout end |
- (Object) node
Returns the value of attribute node
7 8 9 |
# File 'lib/woodhouse/server.rb', line 7 def node @node end |
Instance Method Details
- (Boolean) ready_to_start?
41 42 43 |
# File 'lib/woodhouse/server.rb', line 41 def ready_to_start? @node and @layout and @layout.node(@node) end |
- (Object) reload
37 38 39 |
# File 'lib/woodhouse/server.rb', line 37 def reload dispatch_layout_changes! end |
- (Object) shutdown
TODO: do this better
46 47 48 49 50 51 |
# File 'lib/woodhouse/server.rb', line 46 def shutdown @scheduler.spin_down @scheduler.terminate configuration.triggers.trigger :server_end signal :shutdown end |
- (Object) start
28 29 30 31 32 33 34 35 |
# File 'lib/woodhouse/server.rb', line 28 def start # TODO: don't pass global config @scheduler ||= Woodhouse::Scheduler.new_link(configuration) return false unless ready_to_start? configuration.triggers.trigger :server_start dispatch_layout_changes true end |