Class: Presenters::TubeRackPresenter
- Inherits:
-
Object
- Object
- Presenters::TubeRackPresenter
- Includes:
- Presenter, TubeRackWalking
- Defined in:
- app/models/presenters/tube_rack_presenter.rb
Overview
Basic core presenter class for tube racks Over time, expect this class to use composition to handle the need for different rack presenters based on the tubes within.
Instance Method Summary collapse
-
#barcode ⇒ String
included
from Presenter
Formatted barcode string for display.
- #child_assets ⇒ Object included from Presenter
- #comment_title ⇒ Object
-
#created_on ⇒ String
included
from Presenter
Human formatted date of creation.
- #csv_file_links ⇒ Object
- #default_label_count ⇒ Object included from Presenter
- #default_printer ⇒ Object included from Presenter
-
#input_barcode ⇒ String
included
from Presenter
Formatted stock plate barcode string for display.
- #inspect ⇒ Object included from Presenter
- #label ⇒ Object
- #number_of_tubes ⇒ Object
- #printer_limit ⇒ Object included from Presenter
- #priority ⇒ Object
-
#state ⇒ Object
Returns an augmented state of the tube rack.
- #suggest_library_passing? ⇒ Boolean included from Presenter
- #summary ⇒ Object included from Presenter
- #title ⇒ Object
- #tube_failing_applicable? ⇒ Boolean
- #tube_labels ⇒ Object
- #tubes_by_row ⇒ Object included from TubeRackWalking
Instance Method Details
#barcode ⇒ String Originally defined in module Presenter
Formatted barcode string for display
#child_assets ⇒ Object Originally defined in module Presenter
#comment_title ⇒ Object
65 66 67 |
# File 'app/models/presenters/tube_rack_presenter.rb', line 65 def comment_title "#{} - #{purpose_name} : #{tube_purpose_names}" end |
#created_on ⇒ String Originally defined in module Presenter
Human formatted date of creation
#csv_file_links ⇒ Object
57 58 59 60 61 62 63 |
# File 'app/models/presenters/tube_rack_presenter.rb', line 57 def csv_file_links purpose_config .fetch(:file_links, []) .map do |link| [link.name, [:limber_tube_rack, :export, { id: link.id, limber_tube_rack_id: , format: :csv }]] end end |
#default_label_count ⇒ Object Originally defined in module Presenter
#default_printer ⇒ Object Originally defined in module Presenter
#input_barcode ⇒ String Originally defined in module Presenter
Formatted stock plate barcode string for display
#inspect ⇒ Object Originally defined in module Presenter
#label ⇒ Object
49 50 51 |
# File 'app/models/presenters/tube_rack_presenter.rb', line 49 def label Labels::TubeRackLabel.new(labware) end |
#number_of_tubes ⇒ Object
69 70 71 |
# File 'app/models/presenters/tube_rack_presenter.rb', line 69 def number_of_tubes all_tubes.count end |
#printer_limit ⇒ Object Originally defined in module Presenter
#priority ⇒ Object
37 38 39 |
# File 'app/models/presenters/tube_rack_presenter.rb', line 37 def priority all_tubes.map(&:priority).max end |
#state ⇒ Object
Returns an augmented state of the tube rack. All states take precedence over canceled and failed (in that order or priority) however if we still have a mixed state after that, we display it as such.
26 27 28 29 30 31 32 33 34 35 |
# File 'app/models/presenters/tube_rack_presenter.rb', line 26 def state states = all_tubes.pluck(:state).uniq return states.first if states.one? %w[cancelled failed].each do |filter| states.delete(filter) return states.first if states.one? end 'mixed' end |
#suggest_library_passing? ⇒ Boolean Originally defined in module Presenter
#summary ⇒ Object Originally defined in module Presenter
#title ⇒ Object
41 42 43 |
# File 'app/models/presenters/tube_rack_presenter.rb', line 41 def title "#{purpose_name} : #{tube_purpose_names}" end |
#tube_failing_applicable? ⇒ Boolean
45 46 47 |
# File 'app/models/presenters/tube_rack_presenter.rb', line 45 def tube_failing_applicable? false end |
#tube_labels ⇒ Object
53 54 55 |
# File 'app/models/presenters/tube_rack_presenter.rb', line 53 def tube_labels all_tubes.map { |tube| Labels::TubeLabel.new(tube) } end |