Module: BioChEMBL::DataModel
- Included in:
- Assay, Bioactivity, Compound, Target
- Defined in:
- lib/bio-chembl/datamodel.rb
Overview
ChEMBL database data common utilities
Instance Method Summary collapse
-
#set_attr_accessors(attributes) ⇒ Object
Set attr_accessor of ATTRIBUTES.
-
#set_attr_values(attributes) ⇒ Object
Set the values from XML data on the instance variables.
Instance Method Details
#set_attr_accessors(attributes) ⇒ Object
Set attr_accessor of ATTRIBUTES
11 12 13 14 15 |
# File 'lib/bio-chembl/datamodel.rb', line 11 def set_attr_accessors(attributes) attributes.each do |attr| eval "attr_accessor :#{attr}" end end |
#set_attr_values(attributes) ⇒ Object
Set the values from XML data on the instance variables.
18 19 20 21 22 |
# File 'lib/bio-chembl/datamodel.rb', line 18 def set_attr_values(attributes) attributes.map do |attr| "this.#{attr} = xml.xpath('/#{self.to_s.split('::').last.downcase}/#{attr}').text" end.join("\n") end |