YUKI Piro Hiroshi
null+****@clear*****
Tue Mar 24 23:42:47 JST 2015
YUKI "Piro" Hiroshi 2015-03-24 23:42:47 +0900 (Tue, 24 Mar 2015) New Revision: 6ed73b4730136da57e8ec4c31498c4991bb30869 https://github.com/droonga/droonga-engine/commit/6ed73b4730136da57e8ec4c31498c4991bb30869 Message: Make NodeNmae independent from Address Modified files: lib/droonga/node_name.rb Modified: lib/droonga/node_name.rb (+9 -4) =================================================================== --- lib/droonga/node_name.rb 2015-03-24 23:32:24 +0900 (654adf8) +++ lib/droonga/node_name.rb 2015-03-24 23:42:47 +0900 (7abc6b6) @@ -12,7 +12,7 @@ # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -require "droonga/address" +require "socket" module Droonga class NodeName @@ -42,14 +42,19 @@ module Droonga end end + DEFAULT_HOST = Socket.gethostname + DEFAULT_HOST.force_encoding("US-ASCII") if DEFAULT_HOST.ascii_only? + DEFAULT_PORT = 10031 + DEFAULT_TAG = "droonga" + attr_reader :host attr_reader :port attr_reader :tag def initialize(components={}) - @host = components[:host] || Address::DEFAULT_HOST - @port = components[:port] || Address::DEFAULT_PORT - @tag = components[:tag] || Address::DEFAULT_TAG + @host = components[:host] || DEFAULT_HOST + @port = components[:port] || DEFAULT_PORT + @tag = components[:tag] || DEFAULT_TAG end def to_s -------------- next part -------------- HTML����������������������������...Download