Module: CloudCrowd::ModelStatus
Overview
Adds named scopes and query methods for every CloudCrowd status to both Jobs and WorkUnits.
Class Method Summary collapse
Instance Method Summary collapse
- #complete? ⇒ Boolean
-
#display_status ⇒ Object
Get the displayable status name of the model’s status code.
- #failed? ⇒ Boolean
- #incomplete? ⇒ Boolean
- #merging? ⇒ Boolean
- #processing? ⇒ Boolean
- #splitting? ⇒ Boolean
- #succeeded? ⇒ Boolean
Class Method Details
.included(klass) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/cloud_crowd/models.rb', line 7 def self.included(klass) klass.class_eval do # Note that COMPLETE and INCOMPLETE are unions of other states. named_scope 'processing', :conditions => {:status => PROCESSING} named_scope 'succeeded', :conditions => {:status => SUCCEEDED} named_scope 'failed', :conditions => {:status => FAILED} named_scope 'splitting', :conditions => {:status => SPLITTING} named_scope 'merging', :conditions => {:status => MERGING} named_scope 'complete', :conditions => {:status => COMPLETE} named_scope 'incomplete', :conditions => {:status => INCOMPLETE} end end |
Instance Method Details
#complete? ⇒ Boolean
27 |
# File 'lib/cloud_crowd/models.rb', line 27 def complete?; COMPLETE.include?(self.status); end |
#display_status ⇒ Object
Get the displayable status name of the model’s status code.
31 32 33 |
# File 'lib/cloud_crowd/models.rb', line 31 def display_status CloudCrowd.display_status(self.status) end |
#failed? ⇒ Boolean
24 |
# File 'lib/cloud_crowd/models.rb', line 24 def failed?; self.status == FAILED; end |
#incomplete? ⇒ Boolean
28 |
# File 'lib/cloud_crowd/models.rb', line 28 def incomplete?; INCOMPLETE.include?(self.status); end |
#merging? ⇒ Boolean
26 |
# File 'lib/cloud_crowd/models.rb', line 26 def merging?; self.status == MERGING; end |
#processing? ⇒ Boolean
22 |
# File 'lib/cloud_crowd/models.rb', line 22 def processing?; self.status == PROCESSING; end |
#splitting? ⇒ Boolean
25 |
# File 'lib/cloud_crowd/models.rb', line 25 def splitting?; self.status == SPLITTING; end |
#succeeded? ⇒ Boolean
23 |
# File 'lib/cloud_crowd/models.rb', line 23 def succeeded?; self.status == SUCCEEDED; end |