Class: Spreadsheet::BuilderXmlBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/spreadsheet/builder_xml_builder.rb

Instance Method Summary collapse

Constructor Details

#initializeBuilderXmlBuilder

Returns a new instance of BuilderXmlBuilder.



5
6
7
# File 'lib/spreadsheet/builder_xml_builder.rb', line 5

def initialize
  @xml = ::Builder::XmlMarkup.new
end

Instance Method Details

#import!(builder) ⇒ Object



16
17
18
# File 'lib/spreadsheet/builder_xml_builder.rb', line 16

def import!(builder)
  @xml << builder.to_s
end

#tag!(name, attrs = {}, content = nil) ⇒ Object



9
10
11
12
13
14
# File 'lib/spreadsheet/builder_xml_builder.rb', line 9

def tag!(name, attrs={}, content=nil)
  @xml.tag!(name, attrs) do
    @xml.text!(content) if content
    yield if block_given?
  end
end

#to_sObject



20
21
22
# File 'lib/spreadsheet/builder_xml_builder.rb', line 20

def to_s
  @xml.to_s
end