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
convert_labware_to_receptacle_for, find_by_id_or_name, find_by_id_or_name!
Methods included from Squishify
extended
#broadcast, included, #queue_associated_for_broadcast, #queue_for_broadcast, #warren
Instance Method Details
#barcode_number ⇒ Object
19
20
21
|
# File 'app/models/equipment.rb', line 19
def barcode_number
Barcode.number_to_human(self.ean13_barcode)
end
|
#set_defaults ⇒ Object
10
11
12
|
# File 'app/models/equipment.rb', line 10
def set_defaults
self.prefix ||= 'XX'
end
|
#suffix ⇒ Object
23
24
25
|
# File 'app/models/equipment.rb', line 23
def suffix
Barcode.calculate_checksum(prefix, barcode_number)
end
|
#update_barcode ⇒ Object
14
15
16
17
|
# File 'app/models/equipment.rb', line 14
def update_barcode
self.ean13_barcode ||= Barcode.calculate_barcode(prefix, id)
save!
end
|