Class: Barcode::FormatHandlers::SangerBase

Inherits:
Object
  • Object
show all
Defined in:
app/models/barcode/format_handlers.rb

Overview

Base Sequencescape barcode This class mostly wraps the SBCF Gem

Author:

  • [jg16]

Direct Known Subclasses

SangerCode39, SangerEan13

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(barcode) ⇒ SangerBase

Returns a new instance of SangerBase.



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

def initialize(barcode)
  @barcode_object = SBCF::SangerBarcode.from_human(barcode)
end

Instance Attribute Details

#barcode_objectObject (readonly)

Returns the value of attribute barcode_object.



24
25
26
# File 'app/models/barcode/format_handlers.rb', line 24

def barcode_object
  @barcode_object
end

Instance Method Details

#barcode_prefixObject



55
56
57
# File 'app/models/barcode/format_handlers.rb', line 55

def barcode_prefix
  prefix.human
end

#code128_barcode?Boolean

Returns:

  • (Boolean)


51
52
53
# File 'app/models/barcode/format_handlers.rb', line 51

def code128_barcode?
  true
end

#code39_barcode?Boolean

Returns:

  • (Boolean)


43
44
45
# File 'app/models/barcode/format_handlers.rb', line 43

def code39_barcode?
  true
end

#ean13_barcodeObject

The gem was yielding integers for backward compatible reasons. We’ll convert for the time being, but should probably fix that.



35
36
37
# File 'app/models/barcode/format_handlers.rb', line 35

def ean13_barcode
  barcode_object.machine_barcode.to_s
end

#ean13_barcode?Boolean

Returns:

  • (Boolean)


39
40
41
# File 'app/models/barcode/format_handlers.rb', line 39

def ean13_barcode?
  true
end

#number_as_stringObject



47
48
49
# File 'app/models/barcode/format_handlers.rb', line 47

def number_as_string
  number.to_s
end