Class: ODDB::Remote::Drugs::ActiveAgent

Inherits:
Object
  • Object
show all
Defined in:
lib/oddb/remote/drugs/active_agent.rb

Instance Attribute Summary

Attributes inherited from Object

#remote, #source

Instance Method Summary collapse

Methods inherited from Object

delegate, #initialize, #uid

Constructor Details

This class inherits a constructor from ODDB::Remote::Object

Instance Method Details

#<=>(other) ⇒ Object



17
18
19
20
21
22
23
# File 'lib/oddb/remote/drugs/active_agent.rb', line 17

def <=>(other)
  if(dose.nil?)
    substance <=> other.substance
  else
    [substance, dose] <=> [other.substance, other.dose]
  end
end

#doseObject



11
12
13
# File 'lib/oddb/remote/drugs/active_agent.rb', line 11

def dose
  @dose ||= @remote.dose
end

#substanceObject



14
15
16
# File 'lib/oddb/remote/drugs/active_agent.rb', line 14

def substance
  @substance ||= Remote::Drugs::Substance.new(@source, @remote.substance)
end