Class: Rpub::XmlFile

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

Direct Known Subclasses

Epub::Container, Epub::Content, Epub::Cover, Epub::HtmlToc, Epub::Toc

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (XmlFile) initialize(book = nil)

A new instance of XmlFile



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

- (Object) book (readonly)

Returns the value of attribute book



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

def book
  @book
end

- (Builder::XmlMarkup) xml (readonly)

Returns:

  • (Builder::XmlMarkup)


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

def xml
  @xml
end

Instance Method Details

- (String) to_s

Render this file and output as string

Returns:

  • (String)

    render this file and output as string



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

def to_s
  render
  xml.target!
end