Class: ODDB::Indication

Inherits:
Object show all
Includes:
Language, OddbYaml, RegistrationObserver, SequenceObserver
Defined in:
src/model/indication.rb,
ext/export/src/oddb_yaml.rb,
test/test_model/indication.rb

Constant Summary

ODBA_SERIALIZABLE =
[ '@descriptions', '@synonyms' ]
EXPORT_PROPERTIES =
[
  '@oid',
  '@descriptions',
]

Constants included from OddbYaml

EXPORT_PROPERTIES, YAML_URI

Constants included from Persistence

ODBA_PREDEFINE_SERIALIZABLE

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Methods included from OddbYaml

#to_yaml_properties, #to_yaml_type

Methods included from SequenceObserver

#add_sequence, #initialize, #remove_sequence

Methods included from RegistrationObserver

#add_registration, #article_codes, #iksnrs, #initialize, #registration_count, #remove_registration

Methods included from Language

#all_descriptions, #has_description?, #init, #synonyms, #synonyms=

Methods included from SimpleLanguage

#description, #descriptions, #has_description?, #match, #method_missing, #respond_to?, #to_s, #update_values

Methods included from Persistence

#initialize

Methods included from PersistenceMethods

#checkout, #data_origin, #data_origins, #diff, #init, #nil_if_empty, #parent, #pointer_descr, #structural_ancestors, #undiffable?, #update_values

Constructor Details

This class inherits a constructor from ODDB::SequenceObserver

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class ODDB::SimpleLanguage

Instance Attribute Details

- (Object) registrations (readonly)

Returns the value of attribute registrations



14
15
16
# File 'test/test_model/indication.rb', line 14

def registrations
  @registrations
end

Instance Method Details

- (Object) atc_classes



15
16
17
18
19
20
21
# File 'src/model/indication.rb', line 15

def atc_classes
  atcs = @registrations.inject([]) do |memo, reg| 
    memo.concat reg.atc_classes
  end
  @sequences.each { |seq| atcs.push seq.atc_class }
  atcs.compact.uniq
end

- (Boolean) empty?

Returns:

  • (Boolean)


22
23
24
# File 'src/model/indication.rb', line 22

def empty?
  @registrations.empty? && @sequences.empty?
end

- (Object) merge(other)



32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'src/model/indication.rb', line 32

def merge(other)
  if regs = other.registrations
    regs.dup.each do |reg|
      reg.indication = self
    end
  end
  if seqs = other.sequences
    seqs.dup.each do |seq|
      seq.indication = self
    end
  end
  self.synonyms.concat(other.all_descriptions - all_descriptions).uniq!
  other
end

- (Object) search_text(lang = nil)



25
26
27
28
29
30
31
# File 'src/model/indication.rb', line 25

def search_text(lang=nil)
  if(lang)
    super
  else
    ODDB.search_term(self.all_descriptions.join(" "))
  end
end