On Tue, Feb 23, 2016 at 02:04:34AM +0000, Eric Wong wrote: > 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. > --- > Noticed while reviewing "[RFC] linux: workaround Ruby 2.3 change" > http://bogomips.org/raindrops-public/20160202183136.21549-1-e@80x24.org/raw > > 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 > -- > EW LGTM