Class: Deplate::Regions::DefParticle
- Inherits:
-
Define
- Object
- Element
- Deplate::Region
- Define
- Deplate::Regions::DefParticle
- Defined in:
- lib/deplate/define.rb
Constant Summary collapse
- @@def_particle_counter =
0
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
#define ⇒ Object
252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 |
# File 'lib/deplate/define.rb', line 252 def define rs = deprecated_regnote('rx') if rs # template = @accum.join("\n").gsub(/\'/, "\\\\\'") template = @accum.join("\n") rx = %r{^#{rs}} multiline = valid_switch(@args['multiline'], 'true') collapse = valid_switch(@args['collapse'], 'false') # cls = @deplate.formatter.retrieve_particle(rx.source, template) body = <<-EOR set_rx(#{rx.inspect}) class_attribute :tpl, #{template.inspect} EOR @args[:register] = true @args[:super] = Deplate::Define::Particle cls = Deplate::Cache.particle(deplate, body, @args) end end |