Module: FN::Document::ClassMethods
Instance Method Summary collapse
-
#file(file, options = {}) ⇒ Object
Reads XML from a file, and returns the FN::Document.
-
#migrate_from(xml) ⇒ Object
Creates a new FN::Document from an XML object that is in the old- school (original) style.
-
#string(string, options = {}) ⇒ Object
Reads XML from a string, and returns the FN::Document.
Methods included from Util
#raise_unless_xml_doc, #raise_unless_xml_node
Instance Method Details
#file(file, options = {}) ⇒ Object
Reads XML from a file, and returns the FN::Document
27 28 29 |
# File 'lib/fn/document.rb', line 27 def file(file, = {}) new(XML::Document.file(file), ) end |
#migrate_from(xml) ⇒ Object
Creates a new FN::Document from an XML object that is in the old- school (original) style
17 18 19 20 21 22 23 24 |
# File 'lib/fn/document.rb', line 17 def migrate_from(xml) raise_unless_xml_doc xml @xslt ||= XSLT::Stylesheet.new( XML::Document.file( File.dirname(__FILE__) + "/migrate.xslt" )) return FN::Document.new(@xslt.apply(xml)) end |
#string(string, options = {}) ⇒ Object
Reads XML from a string, and returns the FN::Document
32 33 34 |
# File 'lib/fn/document.rb', line 32 def string(string, = {}) new(XML::Document.string(string), ) end |