Class: Genit::XmlDocument
- Inherits:
-
Object
- Object
- Genit::XmlDocument
- Defined in:
- lib/genit/documents/xml_document.rb
Overview
Open an xml file.
Class Method Summary collapse
-
.open(file) ⇒ Object
Public: Open an xml document.
-
.open_fragment(file) ⇒ Object
Public: Open a fragment of xml document.
Class Method Details
.open(file) ⇒ Object
Public: Open an xml document.
file - Full path String filename.
Returns a Nokogiri::XML document.
16 17 18 |
# File 'lib/genit/documents/xml_document.rb', line 16 def self.open file Nokogiri::XML(File.open(file)) end |
.open_fragment(file) ⇒ Object
Public: Open a fragment of xml document.
file - Full path String filename.
Returns a Nokogiri::XML document.
25 26 27 28 |
# File 'lib/genit/documents/xml_document.rb', line 25 def self.open_fragment file string = IO.read file Nokogiri::XML.fragment string end |