[Groonga-commit] groonga/groonga [master] [query-log][analyzer] support Ruby 1.8.5 on CentOS 5.6.

アーカイブの一覧に戻る

null+****@clear***** null+****@clear*****
2011年 6月 28日 (火) 22:46:46 JST


Kouhei Sutou	2011-06-28 13:46:46 +0000 (Tue, 28 Jun 2011)

  New Revision: 32155faf6c588e1faeaaffe934dc7b62595d7b72

  Log:
    [query-log][analyzer] support Ruby 1.8.5 on CentOS 5.6.

  Modified files:
    tools/groonga-query-log-analyzer

  Modified: tools/groonga-query-log-analyzer (+25 -0)
===================================================================
--- tools/groonga-query-log-analyzer    2011-06-28 13:30:03 +0000 (0d37746)
+++ tools/groonga-query-log-analyzer    2011-06-28 13:46:46 +0000 (2289e79)
@@ -8,6 +8,31 @@ require 'shellwords'
 require 'time'
 require 'erb'
 
+# For ruby 1.8.5 on CentOS 5.6.
+class String
+  unless method_defined?(:start_with?)
+    def start_with?(string)
+      /\A#{Regexp.escape(string)}/ =~ self
+    end
+  end
+end
+
+class Array
+  unless method_defined?(:each_slice)
+    def each_slice(n)
+      sub_elements = []
+      each do |element|
+        sub_elements << element
+        if sub_elements.size == n
+          yield(sub_elements)
+          sub_elements = []
+        end
+      end
+      yield(sub_elements) unless sub_elements.empty?
+    end
+  end
+end
+
 class GroongaQueryLogAnaylzer
   class Error < StandardError
   end




Groonga-commit メーリングリストの案内
アーカイブの一覧に戻る