Class: Equipment
Overview
A table allowing for the generation of unique equipment barcodes. Seems to perform an almost identical function to the unused Implement. No dependencies in the rest of the code, and mainly just used to ensure uniqueness of equipment barcodes.
Instance Method Summary
collapse
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
#barcode_number ⇒ Object
20
21
22
|
# File 'app/models/equipment.rb', line 20
def barcode_number
Barcode.number_to_human(self.ean13_barcode)
end
|
#set_defaults ⇒ Object
11
12
13
|
# File 'app/models/equipment.rb', line 11
def set_defaults
self.prefix ||= 'XX'
end
|
#suffix ⇒ Object
24
25
26
|
# File 'app/models/equipment.rb', line 24
def suffix
Barcode.calculate_checksum(prefix, barcode_number)
end
|
#update_barcode ⇒ Object
15
16
17
18
|
# File 'app/models/equipment.rb', line 15
def update_barcode
self.ean13_barcode ||= Barcode.calculate_barcode(prefix, id)
save!
end
|