I do this a lot in RedCloth. See https://github.com/jgarber/redcloth-parslet/blob/master/lib/redcloth-parslet/parser/inline.rband search for reduce.
On Tue, Feb 21, 2012 at 7:22 PM, John Mettraux <[email protected]> wrote: > > > magic_words = ["magic1","moremagic","evenmoremagic"] > > How about > > rule(:magic_label) { > %w[ magic1 moremagic evenmoremagic ].map { |s| str(s) }.reduce(&:|) > } > > ? > > > Best regards, > > -- > John Mettraux - http://lambda.io/processi > >
