Class: RequestType::Validator::FlowcellTypeValidator
- Inherits:
-
Object
- Object
- RequestType::Validator::FlowcellTypeValidator
- Defined in:
- app/models/request_type/validator.rb
Overview
Validates that the request type provided has a relation with a provided flowcell type name
Instance Attribute Summary collapse
-
#request_type_key ⇒ Object
readonly
Returns the value of attribute request_type_key.
Instance Method Summary collapse
- #allow_blank? ⇒ Boolean
- #include?(option) ⇒ Boolean
-
#initialize(request_type_key) ⇒ FlowcellTypeValidator
constructor
A new instance of FlowcellTypeValidator.
- #request_type ⇒ Object
- #to_a ⇒ Object
Constructor Details
#initialize(request_type_key) ⇒ FlowcellTypeValidator
Returns a new instance of FlowcellTypeValidator.
39 40 41 |
# File 'app/models/request_type/validator.rb', line 39 def initialize(request_type_key) @request_type_key = request_type_key end |
Instance Attribute Details
#request_type_key ⇒ Object (readonly)
Returns the value of attribute request_type_key.
37 38 39 |
# File 'app/models/request_type/validator.rb', line 37 def request_type_key @request_type_key end |
Instance Method Details
#allow_blank? ⇒ Boolean
57 58 59 |
# File 'app/models/request_type/validator.rb', line 57 def allow_blank? true end |
#include?(option) ⇒ Boolean
47 48 49 50 |
# File 'app/models/request_type/validator.rb', line 47 def include?(option) return true if option.nil? request_type.flowcell_types.exists?(name: option) end |
#request_type ⇒ Object
43 44 45 |
# File 'app/models/request_type/validator.rb', line 43 def request_type RequestType.find_by(key: request_type_key) end |
#to_a ⇒ Object
52 53 54 |
# File 'app/models/request_type/validator.rb', line 52 def to_a request_type.flowcell_types.pluck(:name).sort end |