Class: ODDB::State::Drugs::Compare::Comparison

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
src/state/drugs/compare.rb,
test/test_model/comparison.rb

Defined Under Namespace

Classes: PackageFacade

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (Comparison) initialize(package)

A new instance of Comparison



49
50
51
52
53
54
55
# File 'src/state/drugs/compare.rb', line 49

def initialize(package)
  @package = PackageFacade.new(package, package)
  @comparables = package.comparables.collect { |pack|
    PackageFacade.new(pack, package)  
  }.sort
  @comparables
end

Instance Attribute Details

- (Object) comparables (readonly)

Returns the value of attribute comparables



15
16
17
# File 'src/state/drugs/compare.rb', line 15

def comparables
  @comparables
end

- (Object) package (readonly)

Returns the value of attribute package



15
16
17
# File 'src/state/drugs/compare.rb', line 15

def package
  @package
end

- (Object) pointer_descr

Returns the value of attribute pointer_descr



16
17
18
# File 'src/state/drugs/compare.rb', line 16

def pointer_descr
  @pointer_descr
end

Instance Method Details

- (Object) atc_class



63
64
65
# File 'src/state/drugs/compare.rb', line 63

def atc_class
  @package.atc_class
end

- (Object) each {|@package| ... }

Yields:

  • (@package)


56
57
58
59
# File 'src/state/drugs/compare.rb', line 56

def each
  yield @package 
  @comparables.each { |comp| yield comp }
end

- (Boolean) empty?

Returns:

  • (Boolean)


60
61
62
# File 'src/state/drugs/compare.rb', line 60

def empty?
  @comparables.empty?
end

- (Object) name_base



66
67
68
# File 'src/state/drugs/compare.rb', line 66

def name_base
  @package.name_base
end

- (Object) sort_by!(&block)



69
70
71
# File 'src/state/drugs/compare.rb', line 69

def sort_by!(&block)
  @comparables = @comparables.sort_by(&block)
end