Class: ODDB::Fachinfo

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

Defined Under Namespace

Classes: ChangeLogItem

Constant Summary

ODBA_SERIALIZABLE =
['@change_log']
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 RegistrationObserver

#add_registration, #article_codes, #empty?, #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, #structural_ancestors, #undiffable?, #update_values

Constructor Details

This class inherits a constructor from ODDB::RegistrationObserver

Dynamic Method Handling

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

Instance Attribute Details

- (Object) registrations

Returns the value of attribute registrations



15
16
17
# File 'test/test_model/fachinfo.rb', line 15

def registrations
  @registrations
end

Instance Method Details

- (Object) add_change_log_item(email, chapter, language)



18
19
20
21
22
23
24
25
# File 'src/model/fachinfo.rb', line 18

def add_change_log_item(, chapter, language)
  item = ChangeLogItem.new
  item. = 
  item.time = Time.now
  item.chapter = chapter
  item.language = language
  self.change_log.push(item)
end

- (Object) atc_class



26
27
28
29
30
# File 'src/model/fachinfo.rb', line 26

def atc_class
  if(reg = @registrations.first)
    reg.atc_classes.first
  end
end

- (Object) change_log



31
32
33
# File 'src/model/fachinfo.rb', line 31

def change_log
  @change_log ||= []
end

- (Object) company



34
35
36
37
38
# File 'src/model/fachinfo.rb', line 34

def company
  if(reg = @registrations.first)
    reg.company
  end
end

- (Object) company_name



39
40
41
42
43
# File 'src/model/fachinfo.rb', line 39

def company_name
  if(reg = @registrations.first)
    reg.company_name
  end
end

- (Object) generic_type



44
45
46
47
48
49
50
51
# File 'src/model/fachinfo.rb', line 44

def generic_type
  @registrations.each { |reg|
    if(type = reg.generic_type)
      return type
    end
  }
  :unknown
end

- (Object) interaction_text(language)



71
72
73
# File 'src/model/fachinfo.rb', line 71

def interaction_text(language)
  ODDB.search_term(self.send(language).interactions.to_s)
end

- (Object) localized_name(language = :de)



52
53
54
55
56
57
58
59
# File 'src/model/fachinfo.rb', line 52

def localized_name(language=:de)
  name = ''
  if((doc = self.send(language)) && doc.respond_to?(:name))
    name = doc.name.to_s
  end
  name = name_base if(name.empty?)
  name
end

- (Object) name_base



60
61
62
63
64
# File 'src/model/fachinfo.rb', line 60

def name_base
  if(reg = @registrations.first)
    reg.name_base
  end
end

- (Object) pointer_descr



65
66
67
# File 'src/model/fachinfo.rb', line 65

def pointer_descr
  name_base
end

- (Object) search_text(language)



68
69
70
# File 'src/model/fachinfo.rb', line 68

def search_text(language)
  ODDB.search_term(self.send(language).indications.to_s)
end

- (Object) substance_names



74
75
76
77
78
# File 'src/model/fachinfo.rb', line 74

def substance_names
  @registrations.collect { |reg|
    reg.substance_names
  }.flatten.uniq
end

- (Object) to_yaml(opts = {})



243
244
245
246
247
248
249
250
251
252
# File 'ext/export/src/oddb_yaml.rb', line 243

def to_yaml( opts = {} )
  YAML::quick_emit( self.object_id, opts ) { |out|
    out.map( taguri ) { |map|
      to_yaml_properties.each { |m|
        map.add( m[1..-1], instance_variable_get( m ) )
      }
      map.add('article_codes', self.article_codes)
    }
  }
end

- (Object) unwanted_effect_text(language)



79
80
81
# File 'src/model/fachinfo.rb', line 79

def unwanted_effect_text(language)
  ODDB.search_term(self.send(language).unwanted_effects.to_s)
end