Class: OpenTrons::OTProtocol

Inherits:
Object
  • Object
show all
Defined in:
lib/opentrons/otprotocol.rb

Overview

-And more…

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#commandsObject

Returns the value of attribute commands.



34
35
36
# File 'lib/opentrons/otprotocol.rb', line 34

def commands
  @commands
end

#designer_applicationObject

Returns the value of attribute designer_application.



34
35
36
# File 'lib/opentrons/otprotocol.rb', line 34

def designer_application
  @designer_application
end

#instrumentsObject

Returns the value of attribute instruments.



34
35
36
# File 'lib/opentrons/otprotocol.rb', line 34

def instruments
  @instruments
end

#labwareObject

Returns the value of attribute labware.



34
35
36
# File 'lib/opentrons/otprotocol.rb', line 34

def labware
  @labware
end

#metadataObject

Returns the value of attribute metadata.



34
35
36
# File 'lib/opentrons/otprotocol.rb', line 34

def 
  
end

#protocol_schemaObject

Returns the value of attribute protocol_schema.



34
35
36
# File 'lib/opentrons/otprotocol.rb', line 34

def protocol_schema
  @protocol_schema
end

#robotObject

Returns the value of attribute robot.



34
35
36
# File 'lib/opentrons/otprotocol.rb', line 34

def robot
  @robot
end

#trashObject

Returns the value of attribute trash.



34
35
36
# File 'lib/opentrons/otprotocol.rb', line 34

def trash
  @trash
end

Instance Method Details

#inspectObject



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_sObject



73
74
75
# File 'lib/opentrons/otprotocol.rb', line 73

def to_s
  "<OpenTrons::OTProtocol:0x#{self.__id__.to_s(16)}>"
end