Module: Presenters::Presenter

Extended by:
ActiveSupport::Concern
Included in:
PlatePresenter, TubePresenter, TubeRackPresenter
Defined in:
app/models/presenters/presenter.rb

Overview

rubocop:todo Style/Documentation

Instance Method Summary collapse

Instance Method Details

#barcodeString

Formatted barcode string for display

Returns:

  • (String)

    Barcode string. eg. DN1 12200000123



62
63
64
# File 'app/models/presenters/presenter.rb', line 62

def barcode
  useful_barcode(labware.barcode)
end

#child_assetsObject



77
78
79
# File 'app/models/presenters/presenter.rb', line 77

def child_assets
  nil
end

#created_onString

Human formatted date of creation

Returns:

  • (String)

    Human formatted date of creation



55
56
57
# File 'app/models/presenters/presenter.rb', line 55

def created_on
  labware.created_at.to_fs(:date_created)
end

#default_label_countObject



40
41
42
# File 'app/models/presenters/presenter.rb', line 40

def default_label_count
  @default_label_count ||= Settings.printers['default_count']
end

#default_printerObject



36
37
38
# File 'app/models/presenters/presenter.rb', line 36

def default_printer
  @default_printer ||= Settings.printers[purpose_config.default_printer_type]
end

#input_barcodeString

Formatted stock plate barcode string for display

Returns:

  • (String)

    Barcode string. eg. DN1 12200000123



69
70
71
# File 'app/models/presenters/presenter.rb', line 69

def input_barcode
  useful_barcode(labware.stock_plate.try(:barcode))
end

#inspectObject



73
74
75
# File 'app/models/presenters/presenter.rb', line 73

def inspect
  "<#{self.class.name} labware:#{labware.uuid} ...>"
end

#printer_limitObject



44
45
46
# File 'app/models/presenters/presenter.rb', line 44

def printer_limit
  @printer_limit ||= Settings.printers['limit']
end

#suggest_library_passing?Boolean

Returns:

  • (Boolean)


28
29
30
# File 'app/models/presenters/presenter.rb', line 28

def suggest_library_passing?
  active_pipelines.any? { |pl| pl.library_pass?(purpose_name) }
end

#summaryObject



48
49
50
# File 'app/models/presenters/presenter.rb', line 48

def summary
  summary_items.each { |label, method_symbol| yield label, send(method_symbol) }
end

#titleObject



32
33
34
# File 'app/models/presenters/presenter.rb', line 32

def title
  purpose_name
end