YUKI Hiroshi
null+****@clear*****
Thu Sep 12 11:35:22 JST 2013
YUKI Hiroshi 2013-09-12 11:35:22 +0900 (Thu, 12 Sep 2013) New Revision: 0ca2ca75bc56b87db5f3dd50ed63582a269c03e0 https://github.com/droonga/fluent-plugin-droonga/commit/0ca2ca75bc56b87db5f3dd50ed63582a269c03e0 Message: Generate new id string automatically Modified files: lib/groonga_command_converter.rb Modified: lib/groonga_command_converter.rb (+5 -1) =================================================================== --- lib/groonga_command_converter.rb 2013-09-12 11:20:10 +0900 (d017a38) +++ lib/groonga_command_converter.rb 2013-09-12 11:35:22 +0900 (1068c0e) @@ -16,6 +16,7 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA require "groonga/command" +require "digest/sha1" module Droonga class GroongaCommandConverter @@ -54,7 +55,10 @@ module Droonga end def new_unique_id - nil + now = Time.now + now_msec = now.to_i * 1000 + now.usec + random_string = rand(36 ** 16).to_s(36) # Base36 + Digest::SHA1.hexdigest("#{now_msec}:#{random_string}") end def current_date -------------- next part -------------- HTML����������������������������...Download