Class: Tilt::TwiML

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

Instance Method Summary collapse

Instance Method Details

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



10
11
12
13
14
15
# File 'lib/tilt/twiml.rb', line 10

def evaluate(scope, locals, &block)
  return super(scope, locals, &block) if data.respond_to?(:to_str)
  ::TwimlTemplate::Response.new do |response|
    data.call(response)
  end.to_xml
end

#precompiled_postamble(locals) ⇒ Object



26
27
28
# File 'lib/tilt/twiml.rb', line 26

def precompiled_postamble(locals)
  "end.to_xml"
end

#precompiled_preamble(locals) ⇒ Object



21
22
23
24
# File 'lib/tilt/twiml.rb', line 21

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

#precompiled_template(local_keys) ⇒ Object



17
18
19
# File 'lib/tilt/twiml.rb', line 17

def precompiled_template(local_keys)
  data.to_str
end

#prepareObject



8
# File 'lib/tilt/twiml.rb', line 8

def prepare; end