Class: Molecular::Compound
- Inherits:
-
Object
- Object
- Molecular::Compound
- Defined in:
- lib/molecular.rb
Overview
Calling Molecular.compound returns an instance of Molecular::Compound
Instance Method Summary collapse
- #call(atoms) ⇒ Object
-
#initialize(atoms) ⇒ Compound
constructor
A new instance of Compound.
- #to_s ⇒ Object
Constructor Details
#initialize(atoms) ⇒ Compound
Returns a new instance of Compound.
22 23 24 |
# File 'lib/molecular.rb', line 22 def initialize(atoms) @atoms = atoms end |
Instance Method Details
#call(atoms) ⇒ Object
30 31 32 |
# File 'lib/molecular.rb', line 30 def call(atoms) self.class.new(@atoms.merge(atoms)) end |
#to_s ⇒ Object
26 27 28 |
# File 'lib/molecular.rb', line 26 def to_s @atoms.values.compact.join(' ') end |