[Groonga-commit] groonga/fluent-plugin-groonga at 6827740 [master] Support time in String

Back to archive index

Kouhei Sutou null+****@clear*****
Tue Oct 21 15:33:44 JST 2014


Kouhei Sutou	2014-10-21 15:33:44 +0900 (Tue, 21 Oct 2014)

  New Revision: 68277405ba6e041965c762424329fe937132a139
  https://github.com/groonga/fluent-plugin-groonga/commit/68277405ba6e041965c762424329fe937132a139

  Message:
    Support time in String

  Modified files:
    lib/fluent/plugin/out_groonga.rb
    test/output/test_type_guesser.rb

  Modified: lib/fluent/plugin/out_groonga.rb (+2 -2)
===================================================================
--- lib/fluent/plugin/out_groonga.rb    2014-10-21 15:33:08 +0900 (05c0634)
+++ lib/fluent/plugin/out_groonga.rb    2014-10-21 15:33:44 +0900 (1e1620f)
@@ -205,8 +205,8 @@ module Fluent
           old = now - window
           recent_range = old..new
           @sample_values.all? do |sample_value|
-            sample_value.is_a?(Integer) and
-              recent_range.cover?(sample_value)
+            integer_value?(sample_value) and
+              recent_range.cover?(Integer(sample_value))
           end
         end
 

  Modified: test/output/test_type_guesser.rb (+5 -0)
===================================================================
--- test/output/test_type_guesser.rb    2014-10-21 15:33:08 +0900 (183b87e)
+++ test/output/test_type_guesser.rb    2014-10-21 15:33:44 +0900 (a7cc0fe)
@@ -49,6 +49,11 @@ class OutputTypeGuesserTest < Test::Unit::TestCase
         future = now + (9 * year_in_seconds)
         assert_equal("Time", guess([now, past, future]))
       end
+
+      test "string" do
+        now = Time.now.to_i
+        assert_equal("Time", guess([now.to_s]))
+      end
     end
 
     sub_test_case "Int32" do
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index