Class: SimpleBioC::Document

Inherits:
Object
  • Object
show all
Defined in:
lib/simple_bioc/document.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(parent) ⇒ Document

Returns a new instance of Document.


9
10
11
12
13
14
# File 'lib/simple_bioc/document.rb', line 9

def initialize(parent)
  @infons = {}
  @passages = []
  @relations = []
  @collection = parent
end

Instance Attribute Details

#collectionObject (readonly)

parent


7
8
9
# File 'lib/simple_bioc/document.rb', line 7

def collection
  @collection
end

#idObject

attribute


4
5
6
# File 'lib/simple_bioc/document.rb', line 4

def id
  @id
end

#infonsObject

attribute


4
5
6
# File 'lib/simple_bioc/document.rb', line 4

def infons
  @infons
end

#passagesObject

attribute


4
5
6
# File 'lib/simple_bioc/document.rb', line 4

def passages
  @passages
end

#relationsObject

attribute


4
5
6
# File 'lib/simple_bioc/document.rb', line 4

def relations
  @relations
end

Instance Method Details

#adjust_refObject


25
26
27
# File 'lib/simple_bioc/document.rb', line 25

def adjust_ref
  each_relation{|r| r.adjust_ref}
end

#each_relationObject


29
30
31
32
# File 'lib/simple_bioc/document.rb', line 29

def each_relation
  relations.each{|r| yield r}
  passages.each{|p| p.each_relation{|r| yield r}}
end

#find_node(id) ⇒ Object


16
17
18
19
20
21
22
23
# File 'lib/simple_bioc/document.rb', line 16

def find_node(id)
  relations.each{|r| return r if r.id == id}
  passages.each do |p|
    ret = p.find_node(id)
    return ret unless ret.nil?
  end
  nil
end

#to_sObject


34
35
36
# File 'lib/simple_bioc/document.rb', line 34

def to_s
  "Document:#{id}"
end