Method: Regexp::Template#capture_group

Defined in:
lib/core_ext/regexp.rb

#capture_group(atoms, **args) ⇒ Object



319
320
321
322
323
324
325
326
327
328
329
330
331
332
# File 'lib/core_ext/regexp.rb', line 319

def capture_group(atoms,**args)
  if(!atoms.is_a?(Array))
    atoms = [atoms]
  end
  if(args[:name])
    atoms.unshift("?<#{args[:name]}>".to_sym)
  end
  atoms.unshift(:"(")
  atoms.push(:")")
  def atoms.to_sym
    self.map{|a| render_atom(a) }.join('').to_sym
  end
  return atoms
end