[Groonga-commit] groonga/groonga-log at b9aae5f [master] Use to_i to convert from string

Back to archive index

Kentaro Hayashi null+****@clear*****
Wed Sep 27 17:04:30 JST 2017


Kentaro Hayashi	2017-09-27 17:04:30 +0900 (Wed, 27 Sep 2017)

  New Revision: b9aae5f444d4bd9384d46666a84151e796ad7e02
  https://github.com/groonga/groonga-log/commit/b9aae5f444d4bd9384d46666a84151e796ad7e02

  Merged a5120ca: Merge pull request #6 from kenhys/fix-to-i

  Message:
    Use to_i to convert from string
    
    Interger("08") raises ArgumentError.

  Modified files:
    lib/groonga-log/parser.rb

  Modified: lib/groonga-log/parser.rb (+7 -7)
===================================================================
--- lib/groonga-log/parser.rb    2017-09-27 16:48:06 +0900 (f4d4e1c)
+++ lib/groonga-log/parser.rb    2017-09-27 17:04:30 +0900 (0d29293)
@@ -34,13 +34,13 @@ module GroongaLog
         m = PATTERN.match(line)
 
         statistic = Statistic.new
-        statistic.year = Integer(m['year'])
-        statistic.month = Integer(m['month'])
-        statistic.day = Integer(m['day'])
-        statistic.hour = Integer(m['hour'])
-        statistic.minute = Integer(m['minute'])
-        statistic.second = Integer(m['second'])
-        statistic.micro_second = Integer(m['micro_second'])
+        statistic.year = m['year'].to_i
+        statistic.month = m['month'].to_i
+        statistic.day = m['day'].to_i
+        statistic.hour = m['hour'].to_i
+        statistic.minute = m['minute'].to_i
+        statistic.second = m['second'].to_i
+        statistic.micro_second = m['micro_second'].to_i
         statistic.log_level = log_level_to_symbol(m['log_level'])
         statistic.context_id = m['context_id']
         statistic.message = m['message']
-------------- next part --------------
HTML����������������������������...
URL: https://lists.osdn.me/mailman/archives/groonga-commit/attachments/20170927/431a172d/attachment.htm 



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