Class: OpenTrons::OTProtocol
- Inherits:
-
Object
- Object
- OpenTrons::OTProtocol
- Defined in:
- lib/opentrons/otprotocol.rb
Overview
-And more…
Instance Attribute Summary collapse
-
#commands ⇒ Object
Returns the value of attribute commands.
-
#designer_application ⇒ Object
Returns the value of attribute designer_application.
-
#instruments ⇒ Object
Returns the value of attribute instruments.
-
#labware ⇒ Object
Returns the value of attribute labware.
-
#metadata ⇒ Object
Returns the value of attribute metadata.
-
#protocol_schema ⇒ Object
Returns the value of attribute protocol_schema.
-
#robot ⇒ Object
Returns the value of attribute robot.
-
#trash ⇒ Object
Returns the value of attribute trash.
Instance Method Summary collapse
-
#initialize(params: {}) ⇒ OTProtocol
constructor
A new instance of OTProtocol.
- #inspect ⇒ Object
- #to_hash(check_validity: true) ⇒ Object
- #to_json(check_validity: true) ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(params: {}) ⇒ OTProtocol
Returns a new instance of OTProtocol.
36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/opentrons/otprotocol.rb', line 36 def initialize(params: {}) @protocol_schema = params.fetch(:protocol_schema, "1.0.0") @robot = params.fetch(:robot, {"model" => "OT-2 Standard"}) @designer_application = params.fetch(:designer_application, {}) = params.fetch(:metadata, {}) @labware = params.fetch(:labware, Labware.new(self)) @trash = labware.load('fixed-trash', '12', 'Trash') @instruments = params.fetch(:instruments, Instruments.new(self)) @commands = params.fetch(:commands, Commands.new(self)) end |
Instance Attribute Details
#commands ⇒ Object
Returns the value of attribute commands.
34 35 36 |
# File 'lib/opentrons/otprotocol.rb', line 34 def commands @commands end |
#designer_application ⇒ Object
Returns the value of attribute designer_application.
34 35 36 |
# File 'lib/opentrons/otprotocol.rb', line 34 def designer_application @designer_application end |
#instruments ⇒ Object
Returns the value of attribute instruments.
34 35 36 |
# File 'lib/opentrons/otprotocol.rb', line 34 def instruments @instruments end |
#labware ⇒ Object
Returns the value of attribute labware.
34 35 36 |
# File 'lib/opentrons/otprotocol.rb', line 34 def labware @labware end |
#metadata ⇒ Object
Returns the value of attribute metadata.
34 35 36 |
# File 'lib/opentrons/otprotocol.rb', line 34 def end |
#protocol_schema ⇒ Object
Returns the value of attribute protocol_schema.
34 35 36 |
# File 'lib/opentrons/otprotocol.rb', line 34 def protocol_schema @protocol_schema end |
#robot ⇒ Object
Returns the value of attribute robot.
34 35 36 |
# File 'lib/opentrons/otprotocol.rb', line 34 def robot @robot end |
#trash ⇒ Object
Returns the value of attribute trash.
34 35 36 |
# File 'lib/opentrons/otprotocol.rb', line 34 def trash @trash end |
Instance Method Details
#inspect ⇒ Object
77 78 79 |
# File 'lib/opentrons/otprotocol.rb', line 77 def inspect to_s end |
#to_hash(check_validity: true) ⇒ Object
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/opentrons/otprotocol.rb', line 50 def to_hash(check_validity: true) # Returns entire protocol as an OT-protocol-format hash (which can then be converted to json). protocol_hash = {} protocol_hash["protocol-schema"] = protocol_schema protocol_hash["robot"] = robot protocol_hash["designer_application"] = designer_application protocol_hash["metadata"] = protocol_hash["labware"] = labware.to_hash protocol_hash["pipettes"] = instruments.to_hash protocol_hash["procedure"] = [{"subprocedure" => commands.to_list}] return protocol_hash end |
#to_json(check_validity: true) ⇒ Object
68 69 70 71 |
# File 'lib/opentrons/otprotocol.rb', line 68 def to_json(check_validity: true) #converts protocol to a JSON-formatted string return self.to_hash.to_json end |
#to_s ⇒ Object
73 74 75 |
# File 'lib/opentrons/otprotocol.rb', line 73 def to_s "<OpenTrons::OTProtocol:0x#{self.__id__.to_s(16)}>" end |