Class: Chemicalml::Model::Substance
- Defined in:
- lib/chemicalml/model/substance.rb
Overview
A reaction participant. Wraps a Molecule with a role
(e.g. :reactant, :product, :catalyst, :solvent).
Instance Attribute Summary collapse
-
#molecule ⇒ Object
Returns the value of attribute molecule.
-
#role ⇒ Object
Returns the value of attribute role.
-
#title ⇒ Object
Returns the value of attribute title.
Instance Method Summary collapse
- #children ⇒ Object
-
#initialize(molecule:, role: nil, title: nil) ⇒ Substance
constructor
A new instance of Substance.
- #value_attributes ⇒ Object
Methods inherited from Node
#==, #accept, #hash, short_name
Constructor Details
#initialize(molecule:, role: nil, title: nil) ⇒ Substance
Returns a new instance of Substance.
10 11 12 13 14 |
# File 'lib/chemicalml/model/substance.rb', line 10 def initialize(molecule:, role: nil, title: nil) @molecule = molecule @role = role @title = title end |
Instance Attribute Details
#molecule ⇒ Object
Returns the value of attribute molecule.
8 9 10 |
# File 'lib/chemicalml/model/substance.rb', line 8 def molecule @molecule end |
#role ⇒ Object
Returns the value of attribute role.
8 9 10 |
# File 'lib/chemicalml/model/substance.rb', line 8 def role @role end |
#title ⇒ Object
Returns the value of attribute title.
8 9 10 |
# File 'lib/chemicalml/model/substance.rb', line 8 def title @title end |
Instance Method Details
#children ⇒ Object
16 17 18 |
# File 'lib/chemicalml/model/substance.rb', line 16 def children [molecule] end |
#value_attributes ⇒ Object
20 21 22 |
# File 'lib/chemicalml/model/substance.rb', line 20 def value_attributes { molecule: molecule, role: role, title: title } end |