Module: ODDB::RegistrationObserver

Included in:
Company, Fachinfo, Indication, MiniFi
Defined in:
src/model/registration_observer.rb

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Instance Attribute Details

- (Object) registrations (readonly)

Returns the value of attribute registrations



6
7
8
# File 'src/model/registration_observer.rb', line 6

def registrations
  @registrations
end

Instance Method Details

- (Object) add_registration(registration)



11
12
13
14
15
16
17
18
# File 'src/model/registration_observer.rb', line 11

def add_registration(registration)
  unless(@registrations.include?(registration))
    @registrations.push(registration)
    @registrations.odba_isolated_store
    odba_isolated_store # update indices
  end
  registration
end

- (Object) article_codes



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'src/model/registration_observer.rb', line 19

def article_codes
  codes = []
  @registrations.collect { |reg| 
    reg.each_package { |pac|
      cds = {
        :article_ean13 => pac.barcode.to_s,
      }
      if(pcode = pac.pharmacode)
        cds.store(:article_pcode, pcode)
      end
      codes.push(cds)
    }
  }
  codes
end

- (Boolean) empty?

Returns:

  • (Boolean)


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

def empty?
  @registrations.empty?
end

- (Object) iksnrs



47
48
49
# File 'src/model/registration_observer.rb', line 47

def iksnrs
  @registrations.collect { |reg| reg.iksnr }
end

- (RegistrationObserver) initialize

A new instance of RegistrationObserver



7
8
9
10
# File 'src/model/registration_observer.rb', line 7

def initialize
  @registrations = []
  super
end

- (Object) registration_count



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

def registration_count
  @registrations.size
end

- (Object) remove_registration(registration)



40
41
42
43
44
45
46
# File 'src/model/registration_observer.rb', line 40

def remove_registration(registration)
  if(@registrations.delete(registration))
    @registrations.odba_isolated_store
    odba_isolated_store # update indices
  end
  registration
end