[Groonga-commit] droonga/fluent-plugin-droonga at 5090c2a [master] Use extended method of Time class, instead of DateTime class

Back to archive index

Kouhei Sutou kou****@clear*****
Thu Sep 12 12:25:52 JST 2013


> +    def formatted_date(time=Time.now)
> +      time.iso8601
>      end

format_dateの方がいいなぁと思います。引数のtimeをformatする
ので。引数なしでフォーマットされた値を返すならこれでいいと思
います。

> -        :date => @options[:date] || current_date,
> +        :date => formatted_date(@options[:date]),

これは動かないんですよ。

  formatted_date(@options[:date] || Time.now)

にしないといけません。

options[:date]がnilのときはformatted_dateにはnilが渡ってデフォ
ルト値のTime.nowは使われないんです。

In <5090c2a8b0cdab5741827a75b0426f7195996322 �� jenkins.clear-code.com>
  "[Groonga-commit] droonga/fluent-plugin-droonga �� 5090c2a [master] Use extended method of Time class, instead of DateTime class" on Thu, 12 Sep 2013 12:15:47 +0900,
  YUKI Hiroshi <null+groonga �� clear-code.com> wrote:

> YUKI Hiroshi	2013-09-12 12:15:47 +0900 (Thu, 12 Sep 2013)
> 
>   New Revision: 5090c2a8b0cdab5741827a75b0426f7195996322
>   https://github.com/droonga/fluent-plugin-droonga/commit/5090c2a8b0cdab5741827a75b0426f7195996322
> 
>   Message:
>     Use extended method of Time class, instead of DateTime class
> 
>   Modified files:
>     lib/groonga_command_converter.rb
> 
>   Modified: lib/groonga_command_converter.rb (+4 -4)
> ===================================================================
> --- lib/groonga_command_converter.rb    2013-09-12 11:59:43 +0900 (27b3609)
> +++ lib/groonga_command_converter.rb    2013-09-12 12:15:47 +0900 (7c9b918)
> @@ -17,7 +17,7 @@
>  
>  require "groonga/command"
>  require "digest/sha1"
> -require "date"
> +require "time"
>  
>  module Droonga
>    class GroongaCommandConverter
> @@ -54,7 +54,7 @@ module Droonga
>  
>        {
>          :id => id,
> -        :date => @options[:date] || current_date,
> +        :date => formatted_date(@options[:date]),
>          :replyTo => @options[:reply_to],
>          :statusCode => @options[:status_code] || STATUS_OK,
>          :dataset => @options[:dataset],
> @@ -70,8 +70,8 @@ module Droonga
>        Digest::SHA1.hexdigest("#{now_msec}:#{random_string}")
>      end
>  
> -    def current_date
> -      DateTime.now.to_s
> +    def formatted_date(time=Time.now)
> +      time.iso8601
>      end
>  
>      def create_table_create_command




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