[Groonga-commit] groonga/fluent-plugin-groonga-query-log at 45207bc [master] Use list instead of string

Back to archive index
Yasuhiro Horimoto null+****@clear*****
Wed Feb 6 15:10:01 JST 2019


Yasuhiro Horimoto	2019-02-06 15:10:01 +0900 (Wed, 06 Feb 2019)

  Revision: 45207bc6b8f22f95640d895477af9b874c695c36
  https://github.com/groonga/fluent-plugin-groonga-query-log/commit/45207bc6b8f22f95640d895477af9b874c695c36

  Merged 72b3278: Add timezone option (#4)

  Message:
    Use list instead of string

  Modified files:
    lib/fluent/plugin/filter_groonga_query_log.rb
    test/test_filter_groonga_query_log.rb

  Modified: lib/fluent/plugin/filter_groonga_query_log.rb (+4 -2)
===================================================================
--- lib/fluent/plugin/filter_groonga_query_log.rb    2019-02-05 22:29:41 +0900 (f99793e)
+++ lib/fluent/plugin/filter_groonga_query_log.rb    2019-02-06 15:10:01 +0900 (e8893a5)
@@ -26,7 +26,9 @@ module Fluent
     config_param :slow_response_threshold,  :float,  :default => 0.2
     config_param :flatten,                  :bool,   :default => false
     config_param :flatten_separator,        :string, :default => nil
-    config_param :timezone,                 :string, :default => "utc"
+    config_param :timezone,                 :enum,
+                                            :list => [:utc, :localtime],
+                                            :default => :utc
 
     def configure(conf)
       super
@@ -65,7 +67,7 @@ module Fluent
 
     def format_time(time)
       case @timezone
-      when "localtime"
+      when :localtime
         time.iso8601(6)
       else
         time.utc.iso8601(6)

  Modified: test/test_filter_groonga_query_log.rb (+2 -2)
===================================================================
--- test/test_filter_groonga_query_log.rb    2019-02-05 22:29:41 +0900 (f96d029)
+++ test/test_filter_groonga_query_log.rb    2019-02-06 15:10:01 +0900 (e09d3d9)
@@ -40,7 +40,7 @@ class GroongaQueryLogFilterTest < Test::Unit::TestCase
                      :slow_response_threshold  => 0.2,
                      :flatten                  => false,
                      :flatten_separator        => nil,
-                     :timezone                 => "utc",
+                     :timezone                 => :utc,
                    },
                    {
                      :raw_data_column_name     => filter.raw_data_column_name,
@@ -85,7 +85,7 @@ class GroongaQueryLogFilterTest < Test::Unit::TestCase
     test "timezone" do
       driver = create_driver("timezone localtime")
       filter = driver.instance
-      assert_equal("localtime", filter.timezone)
+      assert_equal(:localtime, filter.timezone)
     end
   end
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.osdn.me/mailman/archives/groonga-commit/attachments/20190206/59f4a763/attachment-0001.html>


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