Class: ODDB::Drugs::Substance

Inherits:
Model
  • Object
show all
Includes:
Comparable
Defined in:
lib/oddb/export/yaml.rb,
lib/oddb/drugs/substance.rb,
lib/oddb/persistence/odba/drugs/substance.rb

Constant Summary

Constants included from OddbUri

OddbUri::YAML_URI

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Model

#__odba_delete__, #__odba_save__, _serializables, belongs_to, connections, connector, connectors, #data_origin, #data_origins, delegates, #delete, find_by_uid, has_many, is_coded, m10l_document, multilingual, #odba_serializables, #oid, on_delete, on_save, predicates, #save, #saved?, serializables, serialize, singular

Methods included from ODBA::Persistable

#to_yaml_properties

Methods included from Yaml

append_features, #to_yaml_properties

Methods included from OddbUri

#to_yaml, #to_yaml_map, #to_yaml_type

Instance Attribute Details

#groupObject

Returns the value of attribute group.



13
14
15
# File 'lib/oddb/persistence/odba/drugs/substance.rb', line 13

def group
  @group
end

Instance Method Details

#<=>(other) ⇒ Object



26
27
28
# File 'lib/oddb/drugs/substance.rb', line 26

def <=>(other)
  name <=> other.name
end

#==(other) ⇒ Object



23
24
25
# File 'lib/oddb/drugs/substance.rb', line 23

def ==(other)
  super || name == other
end

#merge(other) ⇒ Object



14
15
16
17
18
19
20
21
22
# File 'lib/oddb/drugs/substance.rb', line 14

def merge(other)
  name.merge other.name
  other.active_agents.dup.each { |agent|
    agent.substance = self
    agent.save
  }
  other.delete
  save
end