Class: Rubabel::Bond
Overview
delegates to obbond object if the method is missing
Instance Attribute Summary collapse
-
#ob ⇒ Object
Returns the value of attribute ob.
Instance Method Summary collapse
-
#atoms ⇒ Object
returns an array of Rubabel::Atoms.
- #bond_order ⇒ Object
-
#bond_order=(val = 1) ⇒ Object
1 = single, 2 = double, 5 = aromatic.
- #each_atom(&block) ⇒ Object (also: #each)
-
#include?(atom) ⇒ Boolean
considered included if the atom ids match.
-
#initialize(obbond) ⇒ Bond
constructor
A new instance of Bond.
- #inspect ⇒ Object
Methods included from Enumerable
Constructor Details
#initialize(obbond) ⇒ Bond
Returns a new instance of Bond.
38 39 40 |
# File 'lib/rubabel/bond.rb', line 38 def initialize(obbond) @ob = obbond end |
Instance Attribute Details
#ob ⇒ Object
Returns the value of attribute ob.
36 37 38 |
# File 'lib/rubabel/bond.rb', line 36 def ob @ob end |
Instance Method Details
#atoms ⇒ Object
returns an array of Rubabel::Atoms
67 68 69 |
# File 'lib/rubabel/bond.rb', line 67 def atoms [@ob.get_begin_atom.upcast, @ob.get_end_atom.upcast] end |
#bond_order ⇒ Object
57 58 59 |
# File 'lib/rubabel/bond.rb', line 57 def bond_order @ob.get_bond_order end |
#bond_order=(val = 1) ⇒ Object
1 = single, 2 = double, 5 = aromatic
62 63 64 |
# File 'lib/rubabel/bond.rb', line 62 def bond_order=(val=1) @ob.set_bond_order(val) end |
#each_atom(&block) ⇒ Object Also known as: each
48 49 50 51 52 53 |
# File 'lib/rubabel/bond.rb', line 48 def each_atom(&block) block or return enum_for(__method__) block.call @ob.get_begin_atom.upcast block.call @ob.get_end_atom.upcast self end |
#include?(atom) ⇒ Boolean
considered included if the atom ids match
43 44 45 46 |
# File 'lib/rubabel/bond.rb', line 43 def include?(atom) # atoms.any? {|atm| atom.id == atm.id } (@ob.get_begin_atom.get_id == atom.id) || (@ob.get_end_atom.get_id == atom.id) end |
#inspect ⇒ Object
71 72 73 |
# File 'lib/rubabel/bond.rb', line 71 def inspect "[#{atoms.map(&:inspect).join('-')}]" end |