Class: InstrumentTypeValidator
- Inherits:
-
ActiveModel::Validator
- Object
- ActiveModel::Validator
- InstrumentTypeValidator
- Defined in:
- app/validators/instrument_type_validator.rb
Overview
Validator for Pacbio InstrumentType:
-
Validates the InstrumentType and its associated Plates and Wells
-
Validates the presence of required attributes
-
Validates the number of Plates and Wells
-
Validates the positions of Wells
-
Validates the combinations of Wells
Instance Attribute Summary collapse
-
#instrument_type ⇒ Object
readonly
Returns the value of attribute instrument_type.
-
#instrument_types ⇒ Object
readonly
Returns the value of attribute instrument_types.
Instance Method Summary collapse
-
#initialize(options) ⇒ InstrumentTypeValidator
constructor
A new instance of InstrumentTypeValidator.
-
#validate(record) ⇒ Object
validates the InstrumentType and its associated Plates and Wells.
Constructor Details
#initialize(options) ⇒ InstrumentTypeValidator
Returns a new instance of InstrumentTypeValidator.
16 17 18 19 |
# File 'app/validators/instrument_type_validator.rb', line 16 def initialize() super @instrument_types = [:instrument_types].with_indifferent_access end |
Instance Attribute Details
#instrument_type ⇒ Object
Returns the value of attribute instrument_type.
12 13 14 |
# File 'app/validators/instrument_type_validator.rb', line 12 def instrument_type @instrument_type end |
#instrument_types ⇒ Object (readonly)
Returns the value of attribute instrument_types.
12 13 14 |
# File 'app/validators/instrument_type_validator.rb', line 12 def instrument_types @instrument_types end |
Instance Method Details
#validate(record) ⇒ Object
validates the InstrumentType and its associated Plates and Wells
23 24 25 26 27 28 29 30 31 32 |
# File 'app/validators/instrument_type_validator.rb', line 23 def validate(record) self.instrument_type = record return if instrument_type.blank? # e.g. if record is a Run, then root is :run validate_model(record.model_name.element.to_sym, record, instrument_type['models']) bubble_errors(record) end |