Module: ODDB::SequenceObserver

Included in:
AtcClass, GalenicForm, Indication, Patinfo, Substance
Defined in:
src/model/sequence_observer.rb

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Instance Attribute Details

- (Object) sequences (readonly)

Returns the value of attribute sequences



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

def sequences
  @sequences
end

Instance Method Details

- (Object) add_sequence(seq)



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

def add_sequence(seq)
  unless(@sequences.include?(seq))
    @sequences.push(seq) 
    @sequences.odba_isolated_store
  end
  odba_isolated_store # rewrite indices
  seq
end

- (Boolean) empty?

Returns:

  • (Boolean)


29
30
31
# File 'src/model/sequence_observer.rb', line 29

def empty?
  @sequences.empty?
end

- (SequenceObserver) initialize

A new instance of SequenceObserver



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

def initialize
  @sequences = []
  super
end

- (Object) remove_sequence(seq)



19
20
21
22
23
24
25
26
27
28
# File 'src/model/sequence_observer.rb', line 19

def remove_sequence(seq)
  ## failsafe-code
  @sequences.delete_if { |s| s.odba_instance.nil? }
  ##
  if(@sequences.delete(seq))
    @sequences.odba_isolated_store
  end
  odba_isolated_store # rewrite indices
  seq
end