From 2a05853cfcd19514299ab99f72a8e6edcc3fcd66 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Tue, 23 Feb 2016 02:04:34 +0000 Subject: linux: remove Pathname stdlib dependency The File.readlink has been available since the earliest SVN import of Ruby from Jan 16 1998. There's no reason to load the Pathname class here since we don't do any further pathname manipulation. So avoid loading the extra .so here and creating extra objects. --- lib/raindrops/linux.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/raindrops/linux.rb b/lib/raindrops/linux.rb index a38fa64..4166ec7 100644 --- a/lib/raindrops/linux.rb +++ b/lib/raindrops/linux.rb @@ -8,7 +8,6 @@ # Instead of snapshotting, Raindrops::Aggregate::LastDataRecv may be used # to aggregate statistics from +all+ accepted sockets as they arrive # based on the +last_data_recv+ field in Raindrops::TCP_Info -require 'pathname' module Raindrops::Linux @@ -46,7 +45,7 @@ module Raindrops::Linux path.force_encoding(Encoding::BINARY) if defined?(Encoding) if File.symlink?(path) link = path - path = Pathname.new(link).realpath.to_s + path = File.readlink(link) path.force_encoding(Encoding::BINARY) if defined?(Encoding) rv[link] = rv[path] # vivify ListenerStats else -- cgit v1.2.3-24-ge0c7