Module: Deplate::Define::TemplateExpander

Included in:
Command, Region
Defined in:
lib/deplate/define.rb

Instance Method Summary collapse

Instance Method Details

#use_template(template = @template, oargs = {}) ⇒ Object



93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# File 'lib/deplate/define.rb', line 93

def use_template(template=@template, oargs={})
    # deplate = @deplate || oargs[:deplate]
    # args    = @args    || oargs[:args]
    # source  = @source  || oargs[:source]
    deplate = oargs[:deplate] || @deplate
    args    = oargs[:args] || @args
    source  = oargs[:source] || @source
    if args['noTemplate'] or deplate.variables['legacyDefine1']
        template
    else
        tmpl = Deplate::Template.new(:master    => deplate,
                                     :template  => template, 
                                     :source    => source, 
                                     :container => self)
        rv = nil
        Deplate::Define.let_variables(deplate, args) do
            rv = tmpl.fill_in(deplate, :source => source)
        end
        rv
    end
end