Class: RTunesU::Document::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/rtunesu/document.rb

Overview

:nodoc:

Direct Known Subclasses

Add, Delete, Merge

Constant Summary collapse

INDENT =
2

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(source, options = {}) ⇒ Base

Creates a new XML document using Builder. Includes the required XML entities of ITunesUDocument and Version, then calls tag_action to add in specific XML entities for the type of document being built. tag_action is defined in each sublcass of Document.



20
21
22
23
24
25
26
27
28
29
# File 'lib/rtunesu/document.rb', line 20

def initialize(source, options = {})
  self.source, self.options = source, options
  builder = Builder::XmlMarkup.new(:indent => INDENT)
  builder.instruct!
  builder.tag!('ITunesUDocument') {
    builder.tag!('Version', RTunesU::API_VERSION)
    self.xml = tag_action(builder)
  }
  self
end

Instance Attribute Details

#builderObject

Returns the value of attribute builder.



15
16
17
# File 'lib/rtunesu/document.rb', line 15

def builder
  @builder
end

#optionsObject

Returns the value of attribute options.



15
16
17
# File 'lib/rtunesu/document.rb', line 15

def options
  @options
end

#sourceObject

Returns the value of attribute source.



15
16
17
# File 'lib/rtunesu/document.rb', line 15

def source
  @source
end

#xmlObject

Returns the value of attribute xml.



15
16
17
# File 'lib/rtunesu/document.rb', line 15

def xml
  @xml
end