Class: VCR::Cassette::ERBRenderer

Inherits:
Object
  • Object
show all
Defined in:
lib/vcr/cassette/erb_renderer.rb

Instance Method Summary collapse

Constructor Details

#initialize(raw_template, erb, cassette_name = nil) ⇒ ERBRenderer

Returns a new instance of ERBRenderer.


7
8
9
# File 'lib/vcr/cassette/erb_renderer.rb', line 7

def initialize(raw_template, erb, cassette_name=nil)
  @raw_template, @erb, @cassette_name = raw_template, erb, cassette_name
end

Instance Method Details

#renderObject


11
12
13
14
15
16
17
# File 'lib/vcr/cassette/erb_renderer.rb', line 11

def render
  return @raw_template if @raw_template.nil? || !use_erb?
  binding = binding_for_variables if erb_variables
  template.result(binding)
rescue NameError => e
  handle_name_error(e)
end