Class: Tilt::VoxML

Inherits:
Template
  • Object
show all
Defined in:
lib/voxml/tilt.rb

Instance Method Summary collapse

Instance Method Details

#evaluate(scope, locals, &block) ⇒ Object



9
10
11
12
13
14
# File 'lib/voxml/tilt.rb', line 9

def evaluate(scope, locals, &block)
  return super(scope, locals, &block) if data.respond_to?(:to_str)
  voxml = ::VoxML::Response.new(start: 'answer') do |response|
    data.call(response)
  end.to_xml
end

#precompiled_postamble(locals) ⇒ Object



25
26
27
# File 'lib/voxml/tilt.rb', line 25

def precompiled_postamble(locals)
  "end.to_xml"
end

#precompiled_preamble(locals) ⇒ Object



20
21
22
23
# File 'lib/voxml/tilt.rb', line 20

def precompiled_preamble(locals)
  return super if locals.include? :twiml
  "::VoxML::Response.new(start: 'answer') do |voxml|\n#{super}"
end

#precompiled_template(local_keys) ⇒ Object



16
17
18
# File 'lib/voxml/tilt.rb', line 16

def precompiled_template(local_keys)
  data.to_str
end

#prepareObject



7
# File 'lib/voxml/tilt.rb', line 7

def prepare; end