Class: Rocx::Parts::BasePart

Inherits:
Object
  • Object
show all
Includes:
Nokogiri
Defined in:
lib/rocx/parts/base_part.rb

Direct Known Subclasses

ContentTypes, Document, GlobalRels, Rels, Settings, Styles

Instance Method Summary collapse

Instance Method Details

#build_standalone_xmlObject



12
13
14
15
# File 'lib/rocx/parts/base_part.rb', line 12

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



8
9
10
# File 'lib/rocx/parts/base_part.rb', line 8

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

#readObject



17
18
19
# File 'lib/rocx/parts/base_part.rb', line 17

def read
  strip_whitespace to_xml
end

#to_xmlObject

Raises:



21
22
23
# File 'lib/rocx/parts/base_part.rb', line 21

def to_xml
  raise NotImplementedError
end