Class: DelegateValidation::Validator
- Inherits:
-
Object
- Object
- DelegateValidation::Validator
- Includes:
- Validateable
- Defined in:
- app/models/delegate_validation.rb
Overview
rubocop:enable Metrics/MethodLength
Direct Known Subclasses
AlwaysValidValidator, ElementAvitiSequencingRequest::ElementAvitiRequestOptionsValidator, NovaSeq6000PESequencingRequest::NovaSeq6000PERequestOptionsValidator, PacBioSamplePrepRequest::RequestOptionsValidator, PacBioSequencingRequest::RequestOptionsValidator, RequestType::Validation::RequestTypeValidator, SequencingRequest::RequestOptionsValidator
Defined Under Namespace
Classes: DelegateError
Class Method Summary collapse
-
.delegate_attribute(*args) ⇒ Object
rubocop:todo Metrics/MethodLength.
- .name ⇒ Object
Instance Method Summary collapse
-
#initialize(target) ⇒ Validator
constructor
A new instance of Validator.
Methods included from Validateable
append_features, #method_missing, #validate!
Constructor Details
#initialize(target) ⇒ Validator
Returns a new instance of Validator.
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'app/models/delegate_validation.rb', line 46 do # NOTE: The following attribute is not required for Microarray Genotyping. # I think this might be broken and suggests that there should be separate classes for project: one for # next-gen sequencing that includes this attribute in it's metadata, and one for microarray genotyping # that doesn't. include ProjectManager::Associations include BudgetDivision::Associations custom_attribute(:project_cost_code, required: true) custom_attribute(:funding_comments) custom_attribute(:collaborators) custom_attribute(:external_funding_source) custom_attribute(:sequencing_budget_cost_centre) custom_attribute(:project_funding_model, in: PROJECT_FUNDING_MODELS) custom_attribute(:gt_committee_tracking_id) before_validation do |record| record.project_cost_code = nil if record.project_cost_code.blank? record.project_funding_model = nil if record.project_funding_model.blank? end end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Validateable
Class Method Details
.delegate_attribute(*args) ⇒ Object
rubocop:todo Metrics/MethodLength
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'app/models/delegate_validation.rb', line 50 do # NOTE: The following attribute is not required for Microarray Genotyping. # I think this might be broken and suggests that there should be separate classes for project: one for # next-gen sequencing that includes this attribute in it's metadata, and one for microarray genotyping # that doesn't. include ProjectManager::Associations include BudgetDivision::Associations custom_attribute(:project_cost_code, required: true) custom_attribute(:funding_comments) custom_attribute(:collaborators) custom_attribute(:external_funding_source) custom_attribute(:sequencing_budget_cost_centre) custom_attribute(:project_funding_model, in: PROJECT_FUNDING_MODELS) custom_attribute(:gt_committee_tracking_id) before_validation do |record| record.project_cost_code = nil if record.project_cost_code.blank? record.project_funding_model = nil if record.project_funding_model.blank? end end |
.name ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'app/models/delegate_validation.rb', line 42 do # NOTE: The following attribute is not required for Microarray Genotyping. # I think this might be broken and suggests that there should be separate classes for project: one for # next-gen sequencing that includes this attribute in it's metadata, and one for microarray genotyping # that doesn't. include ProjectManager::Associations include BudgetDivision::Associations custom_attribute(:project_cost_code, required: true) custom_attribute(:funding_comments) custom_attribute(:collaborators) custom_attribute(:external_funding_source) custom_attribute(:sequencing_budget_cost_centre) custom_attribute(:project_funding_model, in: PROJECT_FUNDING_MODELS) custom_attribute(:gt_committee_tracking_id) before_validation do |record| record.project_cost_code = nil if record.project_cost_code.blank? record.project_funding_model = nil if record.project_funding_model.blank? end end |