Method: ERB#result

Defined in:
lib/rubysl/erb/erb.rb

#result(b = new_toplevel) ⇒ Object

Executes the generated ERB code to produce a completed template, returning the results of that code. (See ERB::new for details on how this process can be affected by safe_level.)

b accepts a Binding or Proc object which is used to set the context of code evaluation.



842
843
844
845
846
847
848
849
850
851
# File 'lib/rubysl/erb/erb.rb', line 842

def result(b=new_toplevel)
  if @safe_level
    proc {
      $SAFE = @safe_level
      eval(@src, b, (@filename || '(erb)'), 0)
    }.call
  else
    eval(@src, b, (@filename || '(erb)'), 0)
  end
end