Class: TVML::Document

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

Constant Summary collapse

JS_ESCAPE_MAP =
{ '\\' => '\\\\', '</' => '<\/', "\r\n" => '\n',
"\n" => '\n', "\r" => '\n', '"' => '\\"', "'" => "\\'" }

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeDocument

Returns a new instance of Document.



8
9
10
11
# File 'lib/TVML/document.rb', line 8

def initialize
  @builder = Builder::XmlMarkup.new
  @builder.instruct!
end

Instance Attribute Details

#builderObject

Returns the value of attribute builder.



3
4
5
# File 'lib/TVML/document.rb', line 3

def builder
  @builder
end

#templateObject

Returns the value of attribute template.



3
4
5
# File 'lib/TVML/document.rb', line 3

def template
  @template
end

Instance Method Details

#buildObject



13
14
15
16
17
# File 'lib/TVML/document.rb', line 13

def build
  @builder.document do |doc|
    doc << @template.build if @template
  end
end

#build_escapedObject



19
20
21
# File 'lib/TVML/document.rb', line 19

def build_escaped
  escape_javascript(build)
end