Class: Pushr::Daemon::App
- Inherits:
-
Object
- Object
- Pushr::Daemon::App
- Defined in:
- lib/pushr/daemon/app.rb
Class Attribute Summary collapse
-
.apps ⇒ Object
readonly
Returns the value of attribute apps.
Class Method Summary collapse
Instance Method Summary collapse
- #connections ⇒ Object
-
#initialize(config) ⇒ App
constructor
A new instance of App.
- #start ⇒ Object
- #stop ⇒ Object
Constructor Details
#initialize(config) ⇒ App
Returns a new instance of App.
26 27 28 29 30 |
# File 'lib/pushr/daemon/app.rb', line 26 def initialize(config) @config = config @handlers = [] @provider = nil end |
Class Attribute Details
.apps ⇒ Object (readonly)
Returns the value of attribute apps.
7 8 9 |
# File 'lib/pushr/daemon/app.rb', line 7 def apps @apps end |
Class Method Details
.load ⇒ Object
9 10 11 |
# File 'lib/pushr/daemon/app.rb', line 9 def load @apps = Pushr::Configuration.all.keep_if { |c| c.enabled == true }.map { |c| App.new(c) } end |
.start ⇒ Object
17 18 19 |
# File 'lib/pushr/daemon/app.rb', line 17 def start @apps.map(&:start) end |
.stop ⇒ Object
21 22 23 |
# File 'lib/pushr/daemon/app.rb', line 21 def stop @apps.map(&:stop) end |
.total_connections ⇒ Object
13 14 15 |
# File 'lib/pushr/daemon/app.rb', line 13 def total_connections @apps.map(&:connections).inject(0, :+) end |
Instance Method Details
#connections ⇒ Object
32 33 34 |
# File 'lib/pushr/daemon/app.rb', line 32 def connections @config.connections end |
#start ⇒ Object
36 37 38 39 |
# File 'lib/pushr/daemon/app.rb', line 36 def start @provider = load_provider(@config.name, @config) @provider.start end |
#stop ⇒ Object
41 42 43 |
# File 'lib/pushr/daemon/app.rb', line 41 def stop @provider.stop end |