Class: Deplate::Regions::DefMacro

Inherits:
Define show all
Defined in:
lib/deplate/define.rb

Instance Method Summary collapse

Methods inherited from Define

check_arguments, #finish, let_variables, #valid_id?, #valid_switch

Methods inherited from Deplate::Region

check_file, clean_strings, #deprecated_regnote, deprecated_regnote, #finish, #finish_accum, #format_compound, regions, register_as, set_line_cont, #setup

Methods inherited from Element

#join_lines, #join_lines_re_zh_cn

Instance Method Details

#defineObject



341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
# File 'lib/deplate/define.rb', line 341

def define
    id = deprecated_regnote('id')
    if valid_id?(id)
        body = <<-EOR
            def setup_template(text)
                @template  = #{@accum.join("\n").inspect}
                @mandatory = #{@args['args'].inspect}
                @macro_id  = #{id.inspect}
            end
        EOR
        @args[:register] = true
        @args[:super]    = Deplate::Define::Macro
        cls = Deplate::Cache.macro(@deplate, body, @args)
    end
end