Class: DoctorNinja::Relationships

Inherits:
Object
  • Object
show all
Defined in:
lib/doctor_ninja/relationships.rb

Instance Method Summary collapse

Constructor Details

#initialize(doc) ⇒ Relationships

Returns a new instance of Relationships.



3
4
5
6
# File 'lib/doctor_ninja/relationships.rb', line 3

def initialize(doc)
  @doc = doc
  @rels = Nokogiri::XML @doc.read "word/_rels/document.xml.rels"
end

Instance Method Details

#path(id) ⇒ Object



14
15
16
17
18
# File 'lib/doctor_ninja/relationships.rb', line 14

def path id
  @rels.xpath("//*[@Id=\"#{id}\"]").attribute("Target").value
rescue
  nil
end

#read(id) ⇒ Object Also known as: []



8
9
10
# File 'lib/doctor_ninja/relationships.rb', line 8

def read id
  @doc.read "word/#{path id}"
end