Class: RequestType::Validator
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- RequestType::Validator
- Defined in:
- app/models/request_type/validator.rb
Overview
A request type validator belongs to a request type, and is responsible for validating a single request option request_option => The option that will be validated valid_options => A serialized object that responds to include? Returning true if the option is present
It should also return an array of valid options in response to to_a
Defined Under Namespace
Classes: ArrayWithDefault, LibraryTypeValidator, NullValidator
Instance Method Summary collapse
Methods inherited from ApplicationRecord
convert_labware_to_receptacle_for, find_by_id_or_name, find_by_id_or_name!
Methods included from Squishify
Methods included from Warren::BroadcastMessages
#broadcast, included, #queue_associated_for_broadcast, #queue_for_broadcast, #warren
Instance Method Details
#default ⇒ Object
88 89 90 |
# File 'app/models/request_type/validator.rb', line 88 def default .respond_to?(:default) ? .default : nil end |
#options ⇒ Object
84 85 86 |
# File 'app/models/request_type/validator.rb', line 84 def .to_a end |
#type_cast ⇒ Object
92 93 94 95 96 97 |
# File 'app/models/request_type/validator.rb', line 92 def type_cast { 'read_length' => :to_i, 'insert_size' => :to_i }[request_option] end |
#validate?(value) ⇒ Boolean
80 81 82 |
# File 'app/models/request_type/validator.rb', line 80 def validate?(value) .include?(value) end |