Class: AsciiChem::Model::Mechanism
- Defined in:
- lib/asciichem/model/mechanism.rb
Overview
A reaction mechanism: multi-step pathway with spectators.
Syntax:
mechanism{
step1: A + B -> C
step2: C -> D + E
spectator: Na+
}
Instance Attribute Summary collapse
-
#spectators ⇒ Object
Returns the value of attribute spectators.
-
#steps ⇒ Object
Returns the value of attribute steps.
Instance Method Summary collapse
- #children ⇒ Object
- #diagnostic_label ⇒ Object
-
#initialize(steps: [], spectators: []) ⇒ Mechanism
constructor
A new instance of Mechanism.
- #value_attributes ⇒ Object
Methods inherited from Node
#==, #accept, #hash, short_name, #to_cml, #to_html, #to_latex, #to_mathml, #to_svg, #to_text
Constructor Details
#initialize(steps: [], spectators: []) ⇒ Mechanism
Returns a new instance of Mechanism.
16 17 18 19 |
# File 'lib/asciichem/model/mechanism.rb', line 16 def initialize(steps: [], spectators: []) @steps = steps @spectators = spectators end |
Instance Attribute Details
#spectators ⇒ Object
Returns the value of attribute spectators.
14 15 16 |
# File 'lib/asciichem/model/mechanism.rb', line 14 def spectators @spectators end |
#steps ⇒ Object
Returns the value of attribute steps.
14 15 16 |
# File 'lib/asciichem/model/mechanism.rb', line 14 def steps @steps end |
Instance Method Details
#children ⇒ Object
25 26 27 |
# File 'lib/asciichem/model/mechanism.rb', line 25 def children [] end |
#diagnostic_label ⇒ Object
29 30 31 |
# File 'lib/asciichem/model/mechanism.rb', line 29 def diagnostic_label "Mechanism(#{steps.length} steps)" end |
#value_attributes ⇒ Object
21 22 23 |
# File 'lib/asciichem/model/mechanism.rb', line 21 def value_attributes { steps: steps, spectators: spectators } end |