Class: CDMBL::CompoundFilter

Inherits:
Object
  • Object
show all
Defined in:
lib/cdmbl/compound_filter.rb

Overview

Takes a list of record id/collection data, uses CompoundLookup to identifiy records with large numbers of compounds and sorts them into a large and a small heap

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(record_ids: [], max_compounds: 10, cdm_endpoint: '', compound_lookup_klass: CompoundLookup) ⇒ CompoundFilter

Returns a new instance of CompoundFilter.



10
11
12
13
14
15
16
17
18
# File 'lib/cdmbl/compound_filter.rb', line 10

def initialize(record_ids: [],
               max_compounds: 10,
               cdm_endpoint: '',
               compound_lookup_klass: CompoundLookup)
  @record_ids            = record_ids
  @max_compounds         = max_compounds
  @cdm_endpoint          = cdm_endpoint
  @compound_lookup_klass = compound_lookup_klass
end

Instance Attribute Details

#cdm_endpointObject (readonly)

Returns the value of attribute cdm_endpoint.



6
7
8
# File 'lib/cdmbl/compound_filter.rb', line 6

def cdm_endpoint
  @cdm_endpoint
end

#compound_lookup_klassObject (readonly)

Returns the value of attribute compound_lookup_klass.



6
7
8
# File 'lib/cdmbl/compound_filter.rb', line 6

def compound_lookup_klass
  @compound_lookup_klass
end

#max_compoundsObject (readonly)

Returns the value of attribute max_compounds.



6
7
8
# File 'lib/cdmbl/compound_filter.rb', line 6

def max_compounds
  @max_compounds
end

#record_idsObject (readonly)

Returns the value of attribute record_ids.



6
7
8
# File 'lib/cdmbl/compound_filter.rb', line 6

def record_ids
  @record_ids
end

Instance Method Details

#filter(large: true) ⇒ Object



20
21
22
# File 'lib/cdmbl/compound_filter.rb', line 20

def filter(large: true)
  ids(records.select { |record| record[:large] == large })
end