Module: PlatesHelper

Defined in:
app/helpers/plates_helper.rb

Overview

rubocop:todo Style/Documentation

Defined Under Namespace

Classes: AliquotError

Instance Method Summary collapse

Instance Method Details

#padded_wells_by_row(plate, overide = nil) ⇒ Object


4
5
6
7
8
9
10
# File 'app/helpers/plates_helper.rb', line 4

def padded_wells_by_row(plate, overide = nil)
  wells = wells_hash(plate)
  padded_well_name_with_index(plate) do |padded_name, index|
    index = padded_name == overide ? :overide : index
    yield(padded_name, *wells[index])
  end
end

#plate_creator_parameters_json(plate_creators) ⇒ Object


20
21
22
23
24
25
26
# File 'app/helpers/plates_helper.rb', line 20

def plate_creator_parameters_json(plate_creators)
  return({}.to_json) unless plate_creators

  plate_creators.each_with_object({}) do |val, memo|
    memo[val.name] = valid_options_for_params(val)
  end.to_json
end

#valid_options_for_params(val) ⇒ Object


12
13
14
15
16
17
18
# File 'app/helpers/plates_helper.rb', line 12

def valid_options_for_params(val)
  return {} unless val.valid_options

  val.valid_options.merge(
    valid_dilution_factors: val.valid_options[:valid_dilution_factors].map(&:to_s)
  )
end