From 84ed3d9964ef593f12d26bf67bf3bb562bf5717d Mon Sep 17 00:00:00 2001 From: akira yamada Date: Mon, 2 Apr 2012 19:31:55 +0900 Subject: [PATCH] apply "o" option to regexps to improve process time --- lib/liquid/variable.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/liquid/variable.rb b/lib/liquid/variable.rb index e9ef63e..cb0b612 100644 --- a/lib/liquid/variable.rb +++ b/lib/liquid/variable.rb @@ -18,14 +18,14 @@ module Liquid @markup = markup @name = nil @filters = [] - if match = markup.match(/\s*(#{QuotedFragment})(.*)/) + if match = markup.match(/\s*(#{QuotedFragment})(.*)/o) @name = match[1] - if match[2].match(/#{FilterSeparator}\s*(.*)/) + if match[2].match(/#{FilterSeparator}\s*(.*)/o) filters = Regexp.last_match(1).scan(FilterParser) filters.each do |f| if matches = f.match(/\s*(\w+)/) filtername = matches[1] - filterargs = f.scan(/(?:#{FilterArgumentSeparator}|#{ArgumentSeparator})\s*(#{QuotedFragment})/).flatten + filterargs = f.scan(/(?:#{FilterArgumentSeparator}|#{ArgumentSeparator})\s*(#{QuotedFragment})/o).flatten @filters << [filtername.to_sym, filterargs] end end