Class: CcTray::Server
- Inherits:
-
Object
- Object
- CcTray::Server
- Defined in:
- lib/cctray/server.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
Returns the value of attribute options.
-
#projects ⇒ Object
Returns the value of attribute projects.
-
#url ⇒ Object
Returns the value of attribute url.
Instance Method Summary collapse
- #[](name) ⇒ Object
- #building? ⇒ Boolean
- #failure? ⇒ Boolean
-
#initialize(url, options = {}) ⇒ Server
constructor
A new instance of Server.
- #run ⇒ Object
-
#sleeping? ⇒ Boolean
summary methods.
- #success? ⇒ Boolean
Constructor Details
#initialize(url, options = {}) ⇒ Server
Returns a new instance of Server.
11 12 13 14 15 16 |
# File 'lib/cctray/server.rb', line 11 def initialize(url, = {}) self.url = url self. = self.projects = {} end |
Instance Attribute Details
#options ⇒ Object
Returns the value of attribute options.
9 10 11 |
# File 'lib/cctray/server.rb', line 9 def @options end |
#projects ⇒ Object
Returns the value of attribute projects.
9 10 11 |
# File 'lib/cctray/server.rb', line 9 def projects @projects end |
#url ⇒ Object
Returns the value of attribute url.
9 10 11 |
# File 'lib/cctray/server.rb', line 9 def url @url end |
Instance Method Details
#[](name) ⇒ Object
31 32 33 |
# File 'lib/cctray/server.rb', line 31 def [](name) projects[name] end |
#building? ⇒ Boolean
40 41 42 |
# File 'lib/cctray/server.rb', line 40 def building? any?(&:building?) end |
#failure? ⇒ Boolean
48 49 50 |
# File 'lib/cctray/server.rb', line 48 def failure? any?(&:failure?) end |
#run ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/cctray/server.rb', line 18 def run deferred = EventMachine::Q.defer http = request.get http.errback { deferred.reject 'request failed' } http.callback { parse http.response deferred.resolve self.projects } deferred.promise end |
#sleeping? ⇒ Boolean
summary methods
36 37 38 |
# File 'lib/cctray/server.rb', line 36 def sleeping? all?.(&:sleeping?) end |
#success? ⇒ Boolean
44 45 46 |
# File 'lib/cctray/server.rb', line 44 def success? all?(&:success?) end |