Class: Chemicalml::Model::Reaction
- Defined in:
- lib/chemicalml/model/reaction.rb
Overview
A chemical reaction. Reactants, products, arrow kind, optional conditions (above / below the arrow).
Constant Summary collapse
- ARROWS =
%i[forward reverse equilibrium resonance].freeze
Instance Attribute Summary collapse
-
#arrow ⇒ Object
Returns the value of attribute arrow.
-
#conditions_above ⇒ Object
Returns the value of attribute conditions_above.
-
#conditions_below ⇒ Object
Returns the value of attribute conditions_below.
-
#id ⇒ Object
Returns the value of attribute id.
-
#product_list ⇒ Object
Returns the value of attribute product_list.
-
#reactant_list ⇒ Object
Returns the value of attribute reactant_list.
-
#title ⇒ Object
Returns the value of attribute title.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
- #children ⇒ Object
-
#initialize(id: nil, reactant_list:, product_list:, arrow: :forward, conditions_above: nil, conditions_below: nil, title: nil, type: nil) ⇒ Reaction
constructor
A new instance of Reaction.
- #value_attributes ⇒ Object
Methods inherited from Node
#==, #accept, #hash, short_name
Constructor Details
#initialize(id: nil, reactant_list:, product_list:, arrow: :forward, conditions_above: nil, conditions_below: nil, title: nil, type: nil) ⇒ Reaction
Returns a new instance of Reaction.
13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/chemicalml/model/reaction.rb', line 13 def initialize(id: nil, reactant_list:, product_list:, arrow: :forward, conditions_above: nil, conditions_below: nil, title: nil, type: nil) @id = id @reactant_list = reactant_list @product_list = product_list @arrow = arrow @conditions_above = conditions_above @conditions_below = conditions_below @title = title @type = type end |
Instance Attribute Details
#arrow ⇒ Object
Returns the value of attribute arrow.
10 11 12 |
# File 'lib/chemicalml/model/reaction.rb', line 10 def arrow @arrow end |
#conditions_above ⇒ Object
Returns the value of attribute conditions_above.
10 11 12 |
# File 'lib/chemicalml/model/reaction.rb', line 10 def conditions_above @conditions_above end |
#conditions_below ⇒ Object
Returns the value of attribute conditions_below.
10 11 12 |
# File 'lib/chemicalml/model/reaction.rb', line 10 def conditions_below @conditions_below end |
#id ⇒ Object
Returns the value of attribute id.
10 11 12 |
# File 'lib/chemicalml/model/reaction.rb', line 10 def id @id end |
#product_list ⇒ Object
Returns the value of attribute product_list.
10 11 12 |
# File 'lib/chemicalml/model/reaction.rb', line 10 def product_list @product_list end |
#reactant_list ⇒ Object
Returns the value of attribute reactant_list.
10 11 12 |
# File 'lib/chemicalml/model/reaction.rb', line 10 def reactant_list @reactant_list end |
#title ⇒ Object
Returns the value of attribute title.
10 11 12 |
# File 'lib/chemicalml/model/reaction.rb', line 10 def title @title end |
#type ⇒ Object
Returns the value of attribute type.
10 11 12 |
# File 'lib/chemicalml/model/reaction.rb', line 10 def type @type end |
Instance Method Details
#children ⇒ Object
26 27 28 |
# File 'lib/chemicalml/model/reaction.rb', line 26 def children [reactant_list, product_list] end |
#value_attributes ⇒ Object
30 31 32 33 34 35 36 37 38 |
# File 'lib/chemicalml/model/reaction.rb', line 30 def value_attributes { id: id, reactant_list: reactant_list, product_list: product_list, arrow: arrow, conditions_above: conditions_above, conditions_below: conditions_below, title: title, type: type } end |