Class: Ilm::Chemistry::Reaction
- Inherits:
-
Object
- Object
- Ilm::Chemistry::Reaction
- Defined in:
- lib/ilm/chemistry/reaction.rb
Overview
This class has functionality for reaction Ex: check for balanced rxn, validity of a rxn
Constant Summary collapse
- STATES =
{ '(s)' => 'solid', '(l)' => 'liquid', '(g)' => 'gaseous', '(aq)' => 'aqueous', '' => '' }.freeze
Instance Attribute Summary collapse
-
#balanced_eqn ⇒ Object
Returns the value of attribute balanced_eqn.
-
#equation ⇒ Object
Returns the value of attribute equation.
-
#is_valid ⇒ Object
Returns the value of attribute is_valid.
-
#participants ⇒ Object
Returns the value of attribute participants.
-
#rate_equation ⇒ Object
Returns the value of attribute rate_equation.
-
#species ⇒ Object
Returns the value of attribute species.
Instance Method Summary collapse
-
#initialize(args) ⇒ Reaction
constructor
A new instance of Reaction.
Constructor Details
#initialize(args) ⇒ Reaction
Returns a new instance of Reaction.
14 15 16 17 18 19 20 21 22 |
# File 'lib/ilm/chemistry/reaction.rb', line 14 def initialize(args) # rate_eqn should be of the form: 'r_{CaO} = k[CaO][CO2]' @equation = args[:equation] @species = build_species @is_valid = valid_rxn? participant_elements @balanced_eqn = balance_rxn @rate_equation = validify_rate_eqn args[:rate_equation] end |
Instance Attribute Details
#balanced_eqn ⇒ Object
Returns the value of attribute balanced_eqn.
6 7 8 |
# File 'lib/ilm/chemistry/reaction.rb', line 6 def balanced_eqn @balanced_eqn end |
#equation ⇒ Object
Returns the value of attribute equation.
6 7 8 |
# File 'lib/ilm/chemistry/reaction.rb', line 6 def equation @equation end |
#is_valid ⇒ Object
Returns the value of attribute is_valid.
6 7 8 |
# File 'lib/ilm/chemistry/reaction.rb', line 6 def is_valid @is_valid end |
#participants ⇒ Object
Returns the value of attribute participants.
6 7 8 |
# File 'lib/ilm/chemistry/reaction.rb', line 6 def participants @participants end |
#rate_equation ⇒ Object
Returns the value of attribute rate_equation.
6 7 8 |
# File 'lib/ilm/chemistry/reaction.rb', line 6 def rate_equation @rate_equation end |
#species ⇒ Object
Returns the value of attribute species.
6 7 8 |
# File 'lib/ilm/chemistry/reaction.rb', line 6 def species @species end |