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)
- - (Boolean) complete?
-
- (Object) display_status
Get the displayable status name of the model's status code.
- - (Boolean) failed?
- - (Boolean) incomplete?
- - (Boolean) merging?
- - (Boolean) processing?
- - (Boolean) splitting?
- - (Boolean) succeeded?
Class Method Details
+ (Object) included(klass)
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
- (Boolean) complete?
27 |
# File 'lib/cloud_crowd/models.rb', line 27
def complete?; COMPLETE.include?(self.status); end
|
- (Object) display_status
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
|
- (Boolean) failed?
24 |
# File 'lib/cloud_crowd/models.rb', line 24
def failed?; self.status == FAILED; end
|
- (Boolean) incomplete?
28 |
# File 'lib/cloud_crowd/models.rb', line 28
def incomplete?; INCOMPLETE.include?(self.status); end
|
- (Boolean) merging?
26 |
# File 'lib/cloud_crowd/models.rb', line 26
def merging?; self.status == MERGING; end
|
- (Boolean) processing?
22 |
# File 'lib/cloud_crowd/models.rb', line 22
def processing?; self.status == PROCESSING; end
|
- (Boolean) splitting?
25 |
# File 'lib/cloud_crowd/models.rb', line 25
def splitting?; self.status == SPLITTING; end
|
- (Boolean) succeeded?
23 |
# File 'lib/cloud_crowd/models.rb', line 23
def succeeded?; self.status == SUCCEEDED; end
|