Class: RobotProperty

Inherits:
ApplicationRecord show all
Defined in:
app/models/robot_property.rb

Instance Method Summary collapse

Methods inherited from ApplicationRecord

convert_labware_to_receptacle_for, find_by_id_or_name, find_by_id_or_name!

Methods included from Warren::BroadcastMessages

#broadcast, included, #queue_associated_for_broadcast, #queue_for_broadcast, #warren

Instance Method Details

#barcodeObject


25
26
27
28
29
# File 'app/models/robot_property.rb', line 25

def barcode
  return nil unless name.nil?

  value.to_i
end

#ean13_barcodeObject


8
9
10
11
12
13
14
15
16
17
# File 'app/models/robot_property.rb', line 8

def ean13_barcode
  if name.nil?
    str = Barcode.calculate_barcode('BD', value.to_i).to_s
    if str.length == 12
      '0' + str
    else
      str
    end
  end
end

#human_barcodeObject


19
20
21
22
23
# File 'app/models/robot_property.rb', line 19

def human_barcode
  return nil unless name.nil?

  'BD' + value.to_s + Barcode.calculate_checksum('BD', value.to_i)
end

#sti_typeObject


31
32
33
# File 'app/models/robot_property.rb', line 31

def sti_type
  self.class
end