Class: ChemScanner::Interpreter::MoleculeGroup
- Inherits:
-
Object
- Object
- ChemScanner::Interpreter::MoleculeGroup
- Defined in:
- lib/chem_scanner/interpreter/element/molecule_group.rb
Overview
MoleculeGroup - molecules represented as text
Instance Attribute Summary collapse
-
#molecule_ids ⇒ Object
readonly
Returns the value of attribute molecule_ids.
-
#molecules ⇒ Object
readonly
Returns the value of attribute molecules.
-
#polygon ⇒ Object
readonly
Returns the value of attribute polygon.
-
#title ⇒ Object
Returns the value of attribute title.
Instance Method Summary collapse
- #add_fragment(fragment) ⇒ Object
-
#initialize(title = nil) ⇒ MoleculeGroup
constructor
A new instance of MoleculeGroup.
- #inspect ⇒ Object
Constructor Details
#initialize(title = nil) ⇒ MoleculeGroup
Returns a new instance of MoleculeGroup.
10 11 12 13 14 |
# File 'lib/chem_scanner/interpreter/element/molecule_group.rb', line 10 def initialize(title = nil) @title = title @molecules = [] @molecule_ids = [] end |
Instance Attribute Details
#molecule_ids ⇒ Object (readonly)
Returns the value of attribute molecule_ids.
8 9 10 |
# File 'lib/chem_scanner/interpreter/element/molecule_group.rb', line 8 def molecule_ids @molecule_ids end |
#molecules ⇒ Object (readonly)
Returns the value of attribute molecules.
8 9 10 |
# File 'lib/chem_scanner/interpreter/element/molecule_group.rb', line 8 def molecules @molecules end |
#polygon ⇒ Object (readonly)
Returns the value of attribute polygon.
8 9 10 |
# File 'lib/chem_scanner/interpreter/element/molecule_group.rb', line 8 def polygon @polygon end |
#title ⇒ Object
Returns the value of attribute title.
7 8 9 |
# File 'lib/chem_scanner/interpreter/element/molecule_group.rb', line 7 def title @title end |
Instance Method Details
#add_fragment(fragment) ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/chem_scanner/interpreter/element/molecule_group.rb', line 16 def add_fragment(fragment) mol = Molecule.new(fragment) mol.process mol.abbreviation = title.value molecules.push(mol) @molecule_ids.push(fragment.id) end |
#inspect ⇒ Object
24 25 26 27 28 29 30 31 |
# File 'lib/chem_scanner/interpreter/element/molecule_group.rb', line 24 def inspect ( "#<MoleculeGroup: id=#{@title.id}, " + "text: #{@title}, " + "molecule_ids: #{@molecule_ids}, " + "molecules: #{@molecules} >" ) end |