From bfa6e5de4ff999af0e9bf1ca9b604249c879e39a Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Fri, 6 Feb 2015 23:11:51 +0000 Subject: favor Class.new for method-less classes This saves over 400 bytes on x86-64. --- lib/yahns.rb | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'lib/yahns.rb') 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) -- cgit v1.2.3-24-ge0c7