Module: Card::Set::All::Erb::Format

Extended by:
Card::Set::AbstractFormat
Defined in:
tmpsets/set/mod003-core/all/erb.rb

Instance Method Summary collapse

Instance Method Details

#render_erb(locals = {}, template = nil, a_binding = nil, &block) ⇒ Object



9
10
11
12
13
14
15
16
17
# File 'tmpsets/set/mod003-core/all/erb.rb', line 9

def render_erb locals={}, template=nil, a_binding=nil, &block
  template ||= yield
  a_binding ||= binding
  locals.each do |k, v|
    # a_binding.local_variable_set(k, v) # needs ruby 2.1
    instance_variable_set("@#{k}", v)
  end
  ERB.new(template, nil, "-").result(binding)
end