Class: Deplate::Regions::DefRegion

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



145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
# File 'lib/deplate/define.rb', line 145

def define
    id = deprecated_regnote('id')
    if valid_id?(id)
        # if @args['lineCont'] == false
            line_cont = 'set_line_cont false'
        # else
        #     line_cont = ''
        # end
        body = <<-EOR
            #{line_cont}
            def setup_template
                @template  = #{@accum.inspect}
                @mandatory = #{@args['args'].inspect}
            end
        EOR
        @args[:register] = true
        @args[:super]    = Deplate::Define::Region
        cls = Deplate::Cache.region(@deplate, body, @args)
    end
end