Class: Molecular::Compound

Inherits:
Object
  • Object
show all
Defined in:
lib/molecular.rb

Overview

Calling Molecular.compound returns an instance of Molecular::Compound

Instance Method Summary collapse

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_sObject



26
27
28
# File 'lib/molecular.rb', line 26

def to_s
  @atoms.values.compact.join(' ')
end