Class: RobotProperty

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

Instance Method Summary collapse

Methods inherited from ApplicationRecord

alias_association, convert_labware_to_receptacle_for, find_by_id_or_name, find_by_id_or_name!

Methods included from Squishify

extended

Instance Method Details

#barcodeObject



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

def barcode
  return nil unless name.nil?

  value.to_i
end

#ean13_barcodeObject



7
8
9
10
11
12
# File 'app/models/robot_property.rb', line 7

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

#human_barcodeObject



14
15
16
17
18
# File 'app/models/robot_property.rb', line 14

def human_barcode
  return nil unless name.nil?

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

#sti_typeObject



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

def sti_type
  self.class
end