diff options
author | Eric Wong <normalperson@yhbt.net> | 2011-02-15 10:13:15 -0800 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2011-02-15 10:13:15 -0800 |
commit | 489d08233b2ec43353e25f857e3639751f4f529b (patch) | |
tree | c96954b9fa0101869c954e45fb106ff936f85a8c /lib/raindrops/middleware.rb | |
parent | 0344ffd5fa6c4693f5a8351e451c6a0852de81ed (diff) | |
download | raindrops-489d08233b2ec43353e25f857e3639751f4f529b.tar.gz |
No need to clutter/confuse namespace lookups
Diffstat (limited to 'lib/raindrops/middleware.rb')
-rw-r--r-- | lib/raindrops/middleware.rb | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/lib/raindrops/middleware.rb b/lib/raindrops/middleware.rb index f5cbb89..8ddac1f 100644 --- a/lib/raindrops/middleware.rb +++ b/lib/raindrops/middleware.rb @@ -3,8 +3,7 @@ require 'raindrops' # Raindrops middleware should be loaded at the top of Rack # middleware stack before other middlewares for maximum accuracy. -class Raindrops -class Middleware < ::Struct.new(:app, :stats, :path, :tcp, :unix) +class Raindrops::Middleware < Struct.new(:app, :stats, :path, :tcp, :unix) # :stopdoc: Stats = Raindrops::Struct.new(:calling, :writing) @@ -57,12 +56,12 @@ class Middleware < ::Struct.new(:app, :stats, :path, :tcp, :unix) body = "calling: #{stats.calling}\n" \ "writing: #{stats.writing}\n" - if defined?(Linux) - Linux.tcp_listener_stats(tcp).each do |addr,stats| + if defined?(Raindrops::Linux) + Raindrops::Linux.tcp_listener_stats(tcp).each do |addr,stats| body << "#{addr} active: #{stats.active}\n" \ "#{addr} queued: #{stats.queued}\n" end if tcp - Linux.unix_listener_stats(unix).each do |addr,stats| + Raindrops::Linux.unix_listener_stats(unix).each do |addr,stats| body << "#{addr} active: #{stats.active}\n" \ "#{addr} queued: #{stats.queued}\n" end if unix @@ -74,6 +73,4 @@ class Middleware < ::Struct.new(:app, :stats, :path, :tcp, :unix) } [ 200, headers, [ body ] ] end - -end end |