Class: Linker
- Inherits:
-
Object
- Object
- Linker
- Defined in:
- lib/almirah/linker.rb
Instance Attribute Summary collapse
-
#field ⇒ Object
Returns the value of attribute field.
Instance Method Summary collapse
-
#initialize ⇒ Linker
constructor
A new instance of Linker.
- #link(doc_A, doc_B) ⇒ Object
Constructor Details
#initialize ⇒ Linker
Returns a new instance of Linker.
8 9 10 |
# File 'lib/almirah/linker.rb', line 8 def initialize() @field = "field" end |
Instance Attribute Details
#field ⇒ Object
Returns the value of attribute field.
6 7 8 |
# File 'lib/almirah/linker.rb', line 6 def field @field end |
Instance Method Details
#link(doc_A, doc_B) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/almirah/linker.rb', line 12 def link(doc_A, doc_B) if doc_A.key == doc_B.up_link_key top_document = doc_A bottom_document = doc_B elsif doc_B.key == doc_A.up_link_key top_document = doc_B bottom_document = doc_A else puts "No Links" return # no links end bottom_document.controlledParagraphs.each do |item| if top_document.dictionary.has_key?(item.up_link.to_s) topItem = top_document.dictionary[item.up_link.to_s] unless topItem.down_links topItem.down_links = Array.new end topItem.down_links.append(item) #if tmp = /^([a-zA-Z]+)[-]\d+/.match(item.id) # top_document.downlinkKey = tmp[1].upcase #end end end end |