Class: DoctorNinja::Relationships
- Inherits:
-
Object
- Object
- DoctorNinja::Relationships
- Defined in:
- lib/doctor_ninja/relationships.rb
Instance Method Summary collapse
-
#initialize(doc) ⇒ Relationships
constructor
A new instance of Relationships.
- #path(id) ⇒ Object
- #read(id) ⇒ Object (also: #[])
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 |