Class: Rpub::XmlFile

Inherits:
Object
  • Object
show all
Defined in:
lib/rpub/xml_file.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(book = nil) ⇒ XmlFile

Returns a new instance of XmlFile.

[View source]

8
9
10
11
# File 'lib/rpub/xml_file.rb', line 8

def initialize(book = nil)
  @xml = Builder::XmlMarkup.new :indent => 2
  @book = book
end

Instance Attribute Details

#bookObject (readonly)

Returns the value of attribute book.


6
7
8
# File 'lib/rpub/xml_file.rb', line 6

def book
  @book
end

#xmlBuilder::XmlMarkup (readonly)

Returns:

  • (Builder::XmlMarkup)

4
5
6
# File 'lib/rpub/xml_file.rb', line 4

def xml
  @xml
end

Instance Method Details

#to_sString

Returns render this file and output as string.

Returns:

  • (String)

    render this file and output as string

[View source]

14
15
16
17
# File 'lib/rpub/xml_file.rb', line 14

def to_s
  render
  xml.target!
end