yahns Ruby server user/dev discussion
 help / color / mirror / code / Atom feed
* [PATCH] favor Class.new for method-less classes
@ 2015-02-06 23:11 Eric Wong
  0 siblings, 0 replies; only message in thread
From: Eric Wong @ 2015-02-06 23:11 UTC (permalink / raw)
  To: yahns-public

This saves over 400 bytes on x86-64.
---
 lib/yahns.rb | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/lib/yahns.rb b/lib/yahns.rb
index fd84223..b4a8bbe 100644
--- a/lib/yahns.rb
+++ b/lib/yahns.rb
@@ -50,11 +50,9 @@ module Yahns # :nodoc:
   # application dispatch.  This is always raised with an empty backtrace
   # since there is nothing in the application stack that is responsible
   # for client shutdowns/disconnects.
-  class ClientShutdown < EOFError # :nodoc:
-  end
+  ClientShutdown = Class.new(EOFError) # :nodoc:
 
-  class ClientTimeout < RuntimeError # :nodoc:
-  end
+  ClientTimeout = Class.new(RuntimeError) # :nodoc:
 
   # try to use the monotonic clock in Ruby >= 2.1, it is immune to clock
   # offset adjustments and generates less garbage (Float vs Time object)
-- 
EW


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2015-02-06 23:11 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-06 23:11 [PATCH] favor Class.new for method-less classes Eric Wong

Code repositories for project(s) associated with this public inbox

	https://yhbt.net/yahns.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).