Class: XMLFileStruct

Inherits:
FileStruct show all
Defined in:
lib/file_struct.rb

Instance Attribute Summary

Attributes inherited from FileStruct

#basename, #ext, #path, #version

Instance Method Summary collapse

Methods inherited from FileStruct

#basic_name, #initialize

Constructor Details

This class inherits a constructor from FileStruct

Instance Method Details

#contentObject



43
44
45
# File 'lib/file_struct.rb', line 43

def content
  @content ||= @doc.to_xml(encoding: 'UTF-8', indent: 2)
end

#docObject



30
31
32
# File 'lib/file_struct.rb', line 30

def doc
  @doc ||= Nokogiri.XML(@content)
end

#reload!Object



34
35
36
37
# File 'lib/file_struct.rb', line 34

def reload!
  super
  @doc = Nokogiri.XML(@content)
end

#save!Object



39
40
41
# File 'lib/file_struct.rb', line 39

def save!
  @content = @doc.to_xml(encoding: 'UTF-8', indent: 2)
end