YUKI Hiroshi
null+****@clear*****
Wed Feb 12 12:40:12 JST 2014
YUKI Hiroshi 2014-02-12 12:40:12 +0900 (Wed, 12 Feb 2014) New Revision: c5f040ce1713da70179e321d6fd17dc4d1bf8123 https://github.com/droonga/fluent-plugin-droonga/commit/c5f040ce1713da70179e321d6fd17dc4d1bf8123 Message: Use to_s instead of "message", as the name of the method to stringify a startup error Modified files: lib/droonga/engine.rb lib/droonga/startup_error.rb Modified: lib/droonga/engine.rb (+1 -1) =================================================================== --- lib/droonga/engine.rb 2014-02-12 12:37:07 +0900 (6ead034) +++ lib/droonga/engine.rb 2014-02-12 12:40:12 +0900 (0af6a46) @@ -24,7 +24,7 @@ module Droonga @options = options @dispatcher = Dispatcher.new(@options) rescue StartupError => error - $log.error(error.message) + $log.error(error.to_s) exit(1) end Modified: lib/droonga/startup_error.rb (+8 -11) =================================================================== --- lib/droonga/startup_error.rb 2014-02-12 12:37:07 +0900 (ac78022) +++ lib/droonga/startup_error.rb 2014-02-12 12:40:12 +0900 (072d2e1) @@ -17,23 +17,20 @@ module Droonga class StartupError < StandardError + attr_reader :message, :detail + def initialize(message, detail=nil) @message = message @detail = detail end - def message - detail = self.detail - detail = "\n#{detail}" unless detail.empty? - "#{self.class.name}\n#{@message}#{detail}" - end - - def detail - if @detail - @detail.to_s - else - "" + def to_s + detail = @edatil + if detail + detail = detail.to_s + detail = "\n#{detail.to_s}" unless detail.empty? end + "#{self.class.name}\n#{@message}#{detail}" end end end -------------- next part -------------- HTML����������������������������... Download