Kouhei Sutou
null+****@clear*****
Thu Apr 11 17:24:17 JST 2013
Kouhei Sutou 2013-04-11 17:24:17 +0900 (Thu, 11 Apr 2013) New Revision: 1d1f84dfa0841076c523fd436339f6aab5382436 https://github.com/groonga/groonga-command/commit/1d1f84dfa0841076c523fd436339f6aab5382436 Message: Extract computing conditions code as a method Modified files: lib/groonga/command/select.rb Modified: lib/groonga/command/select.rb (+11 -6) =================================================================== --- lib/groonga/command/select.rb 2012-12-06 17:35:08 +0900 (b06a09e) +++ lib/groonga/command/select.rb 2013-04-11 17:24:17 +0900 (edcaedc) @@ -49,12 +49,7 @@ module Groonga end def conditions - @conditions ||= filter.split(/(?:&&|&!|\|\|)/).collect do |condition| - condition = condition.strip - condition = condition.gsub(/\A[\s\(]*/, '') - condition = condition.gsub(/[\s\)]*\z/, '') unless /\(/ =~ condition - condition - end + @conditions ||= split_filter_conditions end def drilldowns @@ -64,6 +59,16 @@ module Groonga def output_columns self[:output_columns] end + + private + def split_filter_conditions + filter.split(/(?:&&|&!|\|\|)/).collect do |condition| + condition = condition.strip + condition = condition.gsub(/\A[\s\(]*/, '') + condition = condition.gsub(/[\s\)]*\z/, '') unless /\(/ =~ condition + condition + end + end end end end -------------- next part -------------- HTML����������������������������...Download