Class: ODDB::GalenicGroup

Inherits:
Object show all
Includes:
Language, OddbYaml
Defined in:
test/test_view/asearch.rb,
src/model/galenicgroup.rb,
test/test_util/oddbapp.rb,
ext/export/src/oddb_yaml.rb,
test/test_model/galenicgroup.rb,
test/test_view/navigationfoot.rb,
test/test_view/drugs/galenicgroup.rb

Constant Summary

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

Constants included from OddbYaml

EXPORT_PROPERTIES, YAML_URI

Constants included from Persistence

ODBA_PREDEFINE_SERIALIZABLE

Instance Attribute Summary (collapse)

Class Method Summary (collapse)

Instance Method Summary (collapse)

Methods included from OddbYaml

#to_yaml_properties, #to_yaml_type

Methods included from Language

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

Methods included from SimpleLanguage

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

Methods included from PersistenceMethods

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

Constructor Details

- (GalenicGroup) initialize

A new instance of GalenicGroup



14
15
16
17
# File 'src/model/galenicgroup.rb', line 14

def initialize
  super
  @galenic_forms = {} 
end

Dynamic Method Handling

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

Instance Attribute Details

- (Object) galenic_forms

Returns the value of attribute galenic_forms



13
14
15
# File 'src/model/galenicgroup.rb', line 13

def galenic_forms
  @galenic_forms
end

- (Object) oid (readonly)

Returns the value of attribute oid



13
14
15
# File 'src/model/galenicgroup.rb', line 13

def oid
  @oid
end

- (Object) route_of_administration

Returns the value of attribute route_of_administration



12
13
14
# File 'src/model/galenicgroup.rb', line 12

def route_of_administration
  @route_of_administration
end

Class Method Details

+ (Object) reset_oid



20
21
22
# File 'test/test_view/asearch.rb', line 20

def GalenicGroup.reset_oid
  @oid = 0
end

+ (Object) reset_oids



48
49
50
# File 'test/test_util/oddbapp.rb', line 48

def GalenicGroup::reset_oids
  @oid = 0
end

Instance Method Details

- (Object) ==(other)



54
55
56
# File 'src/model/galenicgroup.rb', line 54

def ==(other)
  @oid > 1 && super # Unknown group does not compare to any
end

- (Object) add(a_galenic_form)



18
19
20
21
22
# File 'src/model/galenicgroup.rb', line 18

def add(a_galenic_form)
  @galenic_forms.store(a_galenic_form.oid, a_galenic_form)
  @galenic_forms.odba_isolated_store
  a_galenic_form
end

- (Object) create_galenic_form



23
24
25
26
27
# File 'src/model/galenicgroup.rb', line 23

def create_galenic_form
  galenic_form = GalenicForm.new
  galenic_form.galenic_group = self
  @galenic_forms.store(galenic_form.oid, galenic_form)
end

- (Object) delete_galenic_form(oid)



28
29
30
31
32
33
# File 'src/model/galenicgroup.rb', line 28

def delete_galenic_form(oid)
  if(form = @galenic_forms.delete(oid.to_i))
    @galenic_forms.odba_isolated_store
    form
  end
end

- (Object) each_galenic_form(&block)



34
35
36
# File 'src/model/galenicgroup.rb', line 34

def each_galenic_form(&block)
  @galenic_forms.each_value(&block)
end

- (Boolean) empty?

Returns:

  • (Boolean)


37
38
39
# File 'src/model/galenicgroup.rb', line 37

def empty?
  @galenic_forms.empty?
end

- (Object) galenic_form(oid)



40
41
42
# File 'src/model/galenicgroup.rb', line 40

def galenic_form(oid)
  @galenic_forms[oid.to_i]
end

- (Object) get_galenic_form(description)



43
44
45
46
47
# File 'src/model/galenicgroup.rb', line 43

def get_galenic_form(description)
  @galenic_forms.values.select { |galenic_form|
    galenic_form.has_description?(description)
  }.first
end

- (Object) remove(a_galenic_form)



48
49
50
51
52
53
# File 'src/model/galenicgroup.rb', line 48

def remove(a_galenic_form)
  if(@galenic_forms.delete(a_galenic_form.oid))
    @galenic_forms.odba_isolated_store
  end
  a_galenic_form
end