Module: Request::LibraryManufacture
- Included in:
- LibraryCreationRequest
- Defined in:
- app/models/request/library_manufacture.rb
Overview
Any request involved in building a library should include this module that defines some of the most common behaviour, namely the library type and insert size information.
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
-
.included(base) ⇒ Object
rubocop:todo Metrics/MethodLength.
Instance Method Summary collapse
Class Method Details
.included(base) ⇒ Object
rubocop:todo Metrics/MethodLength
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'app/models/request/library_manufacture.rb', line 5 def self.included(base) # rubocop:todo Metrics/MethodLength base::Metadata.class_eval do custom_attribute(:fragment_size_required_from, required: true, integer: true, on: :create, minimum: 1) custom_attribute(:fragment_size_required_to, required: true, integer: true, on: :create, minimum: 1) custom_attribute(:library_type, required: true, validator: true, selection: true, on: :create) end base.class_eval { extend ClassMethods } base.const_set( :RequestOptionsValidator, Class.new(DelegateValidation::Validator) do delegate_attribute :fragment_size_required_from, :fragment_size_required_to, to: :target, type_cast: :to_i validates :fragment_size_required_from, numericality: { integer_only: true, greater_than: 0 } validates :fragment_size_required_to, numericality: { integer_only: true, greater_than: 0 } end ) end |
Instance Method Details
#insert_size ⇒ Object
30 31 32 |
# File 'app/models/request/library_manufacture.rb', line 30 def insert_size Aliquot::InsertSize.new(.fragment_size_required_from, .fragment_size_required_to) end |