YUKI Hiroshi
yuki****@clear*****
Thu Sep 12 12:30:27 JST 2013
> options[:date]がnilのときはformatted_dateにはnilが渡ってデフォ > ルト値のTime.nowは使われないんです。 まだ動かしていない状態だったので気がついていませんでした。すみません。 Kouhei Sutou wrote: >> + 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 > > _______________________________________________ > Groonga-commit mailing list > Groonga-commit �� lists.sourceforge.jp > http://lists.sourceforge.jp/mailman/listinfo/groonga-commit > -- 結城 洋志 <YUKI Hiroshi> E-mail: yuki �� clear-code.com 株式会社クリアコード 〒113-0033 東京都文京区本郷3-27-12 本郷デントビル2階 TEL : 03-6231-7270 FAX : 03-6231-7271 WWW : http://www.clear-code.com/