Class: AsciiChem::Model::ReactionCascade
- Defined in:
- lib/asciichem/model/reaction_cascade.rb
Overview
A multi-step reaction cascade: an ordered list of Reaction objects where each step's products are the next step's reactants. Source spelling is a chain of arrows:
A -> B -> C -> D
Single-step reactions stay as Reaction; only multi-step
sequences promote to ReactionCascade.
Instance Attribute Summary collapse
-
#steps ⇒ Object
Returns the value of attribute steps.
Instance Method Summary collapse
- #children ⇒ Object
-
#initialize(steps:) ⇒ ReactionCascade
constructor
A new instance of ReactionCascade.
- #to_s ⇒ Object
- #value_attributes ⇒ Object
Methods inherited from Node
#==, #accept, #diagnostic_label, #hash, short_name, #to_cml, #to_html, #to_latex, #to_mathml, #to_svg, #to_text
Constructor Details
#initialize(steps:) ⇒ ReactionCascade
Returns a new instance of ReactionCascade.
16 17 18 |
# File 'lib/asciichem/model/reaction_cascade.rb', line 16 def initialize(steps:) @steps = steps end |
Instance Attribute Details
#steps ⇒ Object
Returns the value of attribute steps.
14 15 16 |
# File 'lib/asciichem/model/reaction_cascade.rb', line 14 def steps @steps end |
Instance Method Details
#children ⇒ Object
24 25 26 |
# File 'lib/asciichem/model/reaction_cascade.rb', line 24 def children steps end |
#to_s ⇒ Object
28 29 30 |
# File 'lib/asciichem/model/reaction_cascade.rb', line 28 def to_s "ReactionCascade(#{steps.map(&:to_s).join(' >> ')})" end |
#value_attributes ⇒ Object
20 21 22 |
# File 'lib/asciichem/model/reaction_cascade.rb', line 20 def value_attributes { steps: steps } end |