Class: OpenXml::Part

Inherits:
Object
  • Object
show all
Includes:
Nokogiri
Defined in:
lib/open_xml/part.rb

Instance Method Summary collapse

Instance Method Details

#build_standalone_xmlObject



11
12
13
14
# File 'lib/open_xml/part.rb', line 11

def build_standalone_xml
  xml = Nokogiri::XML("<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>")
  XML::Builder.with(xml) { |xml| yield xml }.to_xml
end

#build_xmlObject



7
8
9
# File 'lib/open_xml/part.rb', line 7

def build_xml
  XML::Builder.new(encoding: "utf-8") { |xml| yield xml }.to_xml
end

#readObject Also known as: content



16
17
18
# File 'lib/open_xml/part.rb', line 16

def read
  strip_whitespace to_xml
end

#to_xmlObject

Raises:

  • (NotImplementedError)


21
22
23
# File 'lib/open_xml/part.rb', line 21

def to_xml
  raise NotImplementedError
end