Excellent. Thanks very much for the suggestions, folks.

David

On 2/22/12 11:45 AM, Jason Garber wrote:
> I do this a lot in RedCloth.
> See 
> https://github.com/jgarber/redcloth-parslet/blob/master/lib/redcloth-parslet/parser/inline.rb
> and search for reduce.
> 
> On Tue, Feb 21, 2012 at 7:22 PM, John Mettraux <[email protected]
> <mailto:[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
> 
> 

Reply via email to