module UIC::XMLFileBacked
Supports classes that represent an XML file on disk.
Attributes
doc[RW]
@return [Nokogiri::XML::Document] the Nokogiri
document representing the instance.
Public Instance Methods
file=( new_path )
click to toggle source
Calls superclass method
UIC::FileBacked#file=
# File lib/ruic/interfaces.rb, line 63 def file=( new_path ) super if file_found? @doc = Nokogiri.XML(file_content,&:noblanks) on_doc_loaded if respond_to?(:on_doc_loaded) end end
save!()
click to toggle source
Overwrite the associated file on disk with the {#to_xml} representation of this class. @return [true]
Calls superclass method
UIC::FileBacked#save!
# File lib/ruic/interfaces.rb, line 78 def save! self.file_content = to_xml super end
save_as(new_file)
click to toggle source
Save to the supplied file path. Subsequent calls to {#save!} will save to the new file, not the original file name.
Calls superclass method
UIC::FileBacked#save_as
# File lib/ruic/interfaces.rb, line 84 def save_as(new_file) self.file_content = to_xml super end
to_xml()
click to toggle source
@return [String] the XML representation of the document.
# File lib/ruic/interfaces.rb, line 72 def to_xml doc.to_xml( indent:1, indent_text:"\t" ) end