Class: StateChanger::Base Abstract
- Inherits:
-
Object
- Object
- StateChanger::Base
- Includes:
- ActiveModel::Attributes, ActiveModel::Model
- Defined in:
- app/models/state_changer/base.rb
Overview
This class should not be used directly
This initial StateChanger classes have been derived from the behaviour originally in the corresponding PlatePurpose. This has built up organically over time, and I (JG) don’t believe we actually depend on a lot of the differences in behaviour.
Abstract class for StateChangers, should not be used directly A state changer is designed to handle the transition of a piece of Labware from one state to another. Typically this involved: - Updating the transfer request into and out of the receptacles - Potentially failing the associated requests Usage as of 2021-03-21 Class Used Last used StateChanger::MxTube 43758 2021-03-23 StateChanger::StandardPlate 121793 2021-03-23 StateChanger::InputPlate 14 2021-03-02 StateChanger::InitialStockTube 30823 2021-03-23 StateChanger::StockTube 5650 2021-03-11 StateChanger::QcableLibraryPlate 213 2018-08-16 StateChanger::QcableLabware 3020 2021-03-21 StateChanger::StockMxTube 111 2018-08-20 # Removed
Direct Known Subclasses
Instance Attribute Summary collapse
-
#labware ⇒ Labware
The labware to update the state of.
-
#user ⇒ User
The user performing the action that led to the state change.
Instance Method Summary collapse
-
#associated_request_target_state ⇒ Object
Returns the state to transition associated requests to.
-
#contents ⇒ nil, Array<String>
Array of well locations to update, leave nil or empty for ALL wells.
-
#customer_accepts_responsibility ⇒ Boolean
The customer proceeded against advice and will still be charged in the the event of a failure.
-
#map_target_state_to_associated_request_state ⇒ Hash<String,String>
Maps the #target_state of the StateChanger to the target state of the associated requests.
-
#target_state ⇒ String
String representing the state to transition to.
-
#update_labware_state ⇒ Void
Updates the state of the labware to the target state.
Instance Attribute Details
#labware ⇒ Labware
The labware to update the state of
40 41 42 |
# File 'app/models/state_changer/base.rb', line 40 def labware @labware end |
#user ⇒ User
The user performing the action that led to the state change
44 45 46 |
# File 'app/models/state_changer/base.rb', line 44 def user @user end |
Instance Method Details
#associated_request_target_state ⇒ Object
Returns the state to transition associated requests to. If this returns nil the state changer should not transition the outer requests
66 67 68 |
# File 'app/models/state_changer/base.rb', line 66 def associated_request_target_state map_target_state_to_associated_request_state[target_state] end |
#contents ⇒ nil, Array<String>
Returns Array of well locations to update, leave nil or empty for ALL wells.
50 |
# File 'app/models/state_changer/base.rb', line 50 attribute :contents, default: nil |
#customer_accepts_responsibility ⇒ Boolean
Returns The customer proceeded against advice and will still be charged in the the event of a failure.
54 |
# File 'app/models/state_changer/base.rb', line 54 attribute :customer_accepts_responsibility, :boolean, default: false |
#map_target_state_to_associated_request_state ⇒ Hash<String,String>
Maps the #target_state of the StateChanger to the target state of the associated requests. By default, StateChangers will not transition outer requests if the result of this mapping is nil.
35 |
# File 'app/models/state_changer/base.rb', line 35 class_attribute :map_target_state_to_associated_request_state |
#target_state ⇒ String
Returns String representing the state to transition to.
47 |
# File 'app/models/state_changer/base.rb', line 47 attribute :target_state, :string |
#update_labware_state ⇒ Void
Updates the state of the labware to the target state. The basic implementation does this by updating all of the TransferRequest instances to the state specified. If #contents is blank then the change is assumed to relate to all wells of the plate, otherwise only the selected ones are updated.
60 61 62 |
# File 'app/models/state_changer/base.rb', line 60 def update_labware_state raise NotImplementedError end |