Class: Presenters::TubePresenter
- Inherits:
-
Object
- Object
- Presenters::TubePresenter
- Includes:
- CreationBehaviour, Presenter, RobotControlled, Statemachine::Shared
- Defined in:
- app/models/presenters/tube_presenter.rb
Overview
rubocop:todo Style/Documentation
Direct Known Subclasses
FinalTubePresenter, SimpleTubePresenter, UnknownTubePresenter, VacTubePresenter
Instance Method Summary collapse
- #all_plate_states ⇒ Object included from Statemachine::Shared
-
#barcode ⇒ String
included
from Presenter
Formatted barcode string for display.
- #child_plates ⇒ Object (also: #child_assets)
- #comment_title ⇒ Object
- #compatible_plate_purposes ⇒ Object included from CreationBehaviour
- #compatible_tube_purposes ⇒ Object included from CreationBehaviour
-
#control_state_change ⇒ Object
included
from Statemachine::Shared
Yields to the block if there is the possibility of controlling the state change, passing the valid next states, along with the current one too.
-
#created_on ⇒ String
included
from Presenter
Human formatted date of creation.
- #csv_file_links ⇒ Object
- #custom_metadata_fields ⇒ Object
- #default_label_count ⇒ Object included from Presenter
- #default_printer ⇒ Object included from Presenter
- #default_state_change {|default_transition| ... } ⇒ Object included from Statemachine::Shared
- #default_transition ⇒ Object included from Statemachine::Shared
- #each_robot ⇒ Object included from RobotControlled
-
#input_barcode ⇒ String
included
from Presenter
Formatted stock plate barcode string for display.
- #inspect ⇒ Object included from Presenter
- #label ⇒ Object
- #printer_limit ⇒ Object included from Presenter
- #qc_summary ⇒ Object
- #qc_summary? ⇒ Boolean
- #robot? ⇒ Boolean included from RobotControlled
- #sample_count ⇒ Object
- #sequencescape_submission {|s| ... } ⇒ Object
- #state ⇒ Object included from Statemachine::Shared
-
#state=(value) ⇒ Object
included
from Statemachine::Shared
– We ignore the assignment of the state because that is the statemachine getting in before the plate has been loaded.
- #suggest_library_passing? ⇒ Boolean included from Presenter
- #suggested_purposes ⇒ Object included from CreationBehaviour
- #summary ⇒ Object included from Presenter
- #tag_sequences ⇒ Object
- #title ⇒ Object included from Presenter
- #transfer_volumes? ⇒ Boolean
- #tubes_and_sources ⇒ Object
Instance Method Details
#all_plate_states ⇒ Object Originally defined in module Statemachine::Shared
#barcode ⇒ String Originally defined in module Presenter
Formatted barcode string for display
#child_plates ⇒ Object Also known as: child_assets
56 57 58 |
# File 'app/models/presenters/tube_presenter.rb', line 56 def child_plates labware.child_plates.tap { |child_plates| yield child_plates if block_given? && child_plates.present? } end |
#comment_title ⇒ Object
40 41 42 |
# File 'app/models/presenters/tube_presenter.rb', line 40 def comment_title "#{} - #{purpose_name}" end |
#compatible_plate_purposes ⇒ Object Originally defined in module CreationBehaviour
#compatible_tube_purposes ⇒ Object Originally defined in module CreationBehaviour
#control_state_change ⇒ Object Originally defined in module Statemachine::Shared
Yields to the block if there is the possibility of controlling the state change, passing the valid next states, along with the current one too.
#created_on ⇒ String Originally defined in module Presenter
Human formatted date of creation
#csv_file_links ⇒ Object
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'app/models/presenters/tube_presenter.rb', line 82 def csv_file_links purpose_config .fetch(:file_links, []) .map do |link| format_extension = link.format || 'csv' [ link.name, [ :limber_tube, :tubes_export, { id: link.id, limber_tube_id: , format: format_extension, **link.params || {} } ] ] end end |
#custom_metadata_fields ⇒ Object
44 45 46 |
# File 'app/models/presenters/tube_presenter.rb', line 44 def purpose_config.fetch(:custom_metadata_fields, []).to_a.to_json end |
#default_label_count ⇒ Object Originally defined in module Presenter
#default_printer ⇒ Object Originally defined in module Presenter
#default_state_change {|default_transition| ... } ⇒ Object Originally defined in module Statemachine::Shared
#default_transition ⇒ Object Originally defined in module Statemachine::Shared
#each_robot ⇒ Object Originally defined in module RobotControlled
#input_barcode ⇒ String Originally defined in module Presenter
Formatted stock plate barcode string for display
#inspect ⇒ Object Originally defined in module Presenter
#label ⇒ Object
26 27 28 29 30 |
# File 'app/models/presenters/tube_presenter.rb', line 26 def label # fetch label class from purpose if present label_class = purpose_config.fetch(:label_class) || 'Labels::TubeLabel' label_class.constantize.new(labware) end |
#printer_limit ⇒ Object Originally defined in module Presenter
#qc_summary ⇒ Object
70 71 72 73 74 75 76 |
# File 'app/models/presenters/tube_presenter.rb', line 70 def qc_summary labware .receptacle .all_latest_qc .sort_by(&:key) .each { |result| yield result.key.titleize, result.unit_value.to_s } end |
#qc_summary? ⇒ Boolean
66 67 68 |
# File 'app/models/presenters/tube_presenter.rb', line 66 def qc_summary? labware.receptacle&.all_latest_qc&.to_a.present? end |
#robot? ⇒ Boolean Originally defined in module RobotControlled
#sample_count ⇒ Object
32 33 34 |
# File 'app/models/presenters/tube_presenter.rb', line 32 def sample_count labware.aliquots.count end |
#sequencescape_submission {|s| ... } ⇒ Object
48 49 50 51 52 53 54 |
# File 'app/models/presenters/tube_presenter.rb', line 48 def sequencescape_submission return nil if purpose_config.submission.empty? s = SequencescapeSubmission.new(purpose_config.submission.to_hash.merge(assets: [labware.uuid])) yield s if block_given? s end |
#state ⇒ Object Originally defined in module Statemachine::Shared
#state=(value) ⇒ Object Originally defined in module Statemachine::Shared
– We ignore the assignment of the state because that is the statemachine getting in before the plate has been loaded. ++
#suggest_library_passing? ⇒ Boolean Originally defined in module Presenter
#suggested_purposes ⇒ Object Originally defined in module CreationBehaviour
#summary ⇒ Object Originally defined in module Presenter
#tag_sequences ⇒ Object
36 37 38 |
# File 'app/models/presenters/tube_presenter.rb', line 36 def tag_sequences labware.aliquots.map(&:tag_pair) end |
#title ⇒ Object Originally defined in module Presenter
#transfer_volumes? ⇒ Boolean
78 79 80 |
# File 'app/models/presenters/tube_presenter.rb', line 78 def transfer_volumes? !purpose_config[:transfer_parameters].nil? end |
#tubes_and_sources ⇒ Object
62 63 64 |
# File 'app/models/presenters/tube_presenter.rb', line 62 def tubes_and_sources labware.child_tubes.tap { |child_tubes| yield child_tubes if block_given? && child_tubes.present? } end |