Class: Ruby2xlsx::Template

Inherits:
Base
  • Object
show all
Defined in:
lib/ruby2xlsx/template.rb

Instance Method Summary collapse

Methods inherited from Base

#add_worksheet, #initialize, #method_missing, #workbook, #worksheet, #worksheet_name

Constructor Details

This class inherits a constructor from Ruby2xlsx::Base

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Ruby2xlsx::Base

Instance Method Details

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

Renders the representation based on source, object, scope and locals Template.new(“…source…”, { :format => “xlsx” }).render(scope, { :foo => “bar”, :object => @user })



7
8
9
10
11
12
13
14
15
# File 'lib/ruby2xlsx/template.rb', line 7

def render(scope, locals, &block)
  @locals, @scope = locals, scope
  set_locals_variables
  
  instance_eval(@source) if @source.present?
  instance_eval(&block) if block_given?
  
  super
end