Class: Sibling
- Inherits:
-
Object
- Object
- Sibling
- Defined in:
- app/models/sibling.rb
Overview
Used by the final tube form, siblings describe other tubes that are part of the same submission, as well as placeholders for tubes which are still due to be created.
Constant Summary collapse
- READY_STATE =
The state in which a sibling must be to allow pooling.
'passed'
Instance Attribute Summary collapse
-
#barcode ⇒ Object
readonly
Returns the value of attribute barcode.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#sanger_barcode ⇒ Object
readonly
Returns the value of attribute sanger_barcode.
-
#state ⇒ Object
readonly
Returns the value of attribute state.
-
#uuid ⇒ Object
readonly
Returns the value of attribute uuid.
Instance Method Summary collapse
-
#initialize(options) ⇒ Sibling
constructor
A new instance of Sibling.
- #message ⇒ Object
- #ready? ⇒ Boolean
Constructor Details
#initialize(options) ⇒ Sibling
Returns a new instance of Sibling.
12 13 14 15 16 17 18 19 20 21 22 |
# File 'app/models/sibling.rb', line 12 def initialize() if .respond_to?(:fetch) @name = .fetch('name', 'UNKNOWN') @uuid = .fetch('uuid', nil) @barcode = .fetch('ean13_barcode', 'UNKNOWN') @sanger_barcode = SBCF::SangerBarcode.from_machine(.fetch('ean13_barcode', 'UNKNOWN')) @state = .fetch('state', 'UNKNOWN') else missing_sibling end end |
Instance Attribute Details
#barcode ⇒ Object (readonly)
Returns the value of attribute barcode.
10 11 12 |
# File 'app/models/sibling.rb', line 10 def @barcode end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
10 11 12 |
# File 'app/models/sibling.rb', line 10 def name @name end |
#sanger_barcode ⇒ Object (readonly)
Returns the value of attribute sanger_barcode.
10 11 12 |
# File 'app/models/sibling.rb', line 10 def @sanger_barcode end |
#state ⇒ Object (readonly)
Returns the value of attribute state.
10 11 12 |
# File 'app/models/sibling.rb', line 10 def state @state end |
#uuid ⇒ Object (readonly)
Returns the value of attribute uuid.
10 11 12 |
# File 'app/models/sibling.rb', line 10 def uuid @uuid end |
Instance Method Details
#message ⇒ Object
24 25 26 27 28 29 |
# File 'app/models/sibling.rb', line 24 def return 'This tube is ready for pooling, find it, and scan it in above' if state == READY_STATE return 'Some requests still need to be progressed to appropriate tubes' if state == 'Not Present' "Must be #{READY_STATE.humanize} first" end |
#ready? ⇒ Boolean
31 32 33 |
# File 'app/models/sibling.rb', line 31 def ready? state == READY_STATE end |