From fdfdcc7be1e28f0ad47cc9cda41355d78b9ea8b4 Mon Sep 17 00:00:00 2001 From: wycats Date: Sun, 13 Mar 2011 14:01:57 +0100 Subject: [PATCH] Fix intentional nil code --- lib/net2/http/statuses.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/net2/http/statuses.rb b/lib/net2/http/statuses.rb index ead0630..c154125 100644 --- a/lib/net2/http/statuses.rb +++ b/lib/net2/http/statuses.rb @@ -37,14 +37,17 @@ def self.subclass(name, code, options = {}) klass.const_set :HAS_BODY, options.key?(:body) ? options[:body] : self::HAS_BODY klass.const_set :EXCEPTION_TYPE, options[:error] || self::EXCEPTION_TYPE + # for backwards compatibility with Net::HTTP + Net2.const_set "HTTP#{name}", klass + + return unless code + if code < 100 CODE_CLASS_TO_OBJ[code.to_s] = klass else CODE_TO_OBJ[code.to_s] = klass end - # for backwards compatibility with Net::HTTP - Net2.const_set "HTTP#{name}", klass end end