From: Eric Wong <e@80x24.org>
To: http_spew-public@bogomips.org
Cc: Eric Wong <e@80x24.org>
Subject: [PATCH 1/5] declare empty classes with constant assignment
Date: Fri, 28 Oct 2016 20:14:59 +0000 [thread overview]
Message-ID: <20161028201503.10315-2-e@80x24.org> (raw)
In-Reply-To: <20161028201503.10315-1-e@80x24.org>
Normal constant assignments generate less bytecode than
defineclass instructions. While we're in the area, use
require_relative to avoid unnecessary path traversals.
---
lib/http_spew.rb | 26 +++++++++++++-------------
1 file changed, 13 insertions(+), 13 deletions(-)
diff --git a/lib/http_spew.rb b/lib/http_spew.rb
index 84359eb..e6bde3b 100644
--- a/lib/http_spew.rb
+++ b/lib/http_spew.rb
@@ -8,20 +8,20 @@ module HTTP_Spew
autoload :HitNRun, "http_spew/hit_n_run"
autoload :InputSpray, "http_spew/input_spray"
- class Error < RuntimeError; end
- class TimeoutError < Error; end
- class ConnectionReset < Error; end
- class RequestError < Error; end
- class UnexpectedResponse < RequestError; end
- class ChecksumError < HTTP_Spew::Error; end
- class LengthError < HTTP_Spew::Error; end
- class NoWritersError < HTTP_Spew::Error; end
- class EOF < EOFError; end
+ Error = Class.new(RuntimeError)
+ TimeoutError = Class.new(Error)
+ ConnectionReset = Class.new(Error)
+ RequestError = Class.new(Error)
+ UnexpectedResponse = Class.new(RequestError)
+ ChecksumError = Class.new(Error)
+ LengthError = Class.new(Error)
+ NoWritersError = Class.new(Error)
+ EOF = Class.new(EOFError)
- require "http_spew/version"
- require "http_spew/headers"
- require "http_spew/request"
- require "http_spew/class_methods"
+ require_relative "http_spew/version"
+ require_relative "http_spew/headers"
+ require_relative "http_spew/request"
+ require_relative "http_spew/class_methods"
extend HTTP_Spew::ClassMethods
end
--
EW
next prev parent reply other threads:[~2016-10-28 20:15 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-28 20:14 [PATCH 0/5] random half-brained updates Eric Wong
2016-10-28 20:14 ` Eric Wong [this message]
2016-10-28 20:15 ` [PATCH 2/5] test_upload: use object_id to check matches Eric Wong
2016-10-28 20:15 ` [PATCH 3/5] use frozen string literals for Ruby 2.1+ Eric Wong
2016-10-28 20:15 ` [PATCH 4/5] merge into kcar project and mailing list Eric Wong
2016-10-28 20:15 ` [PATCH 5/5] dedicated " Eric Wong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://yhbt.net/http_spew/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20161028201503.10315-2-e@80x24.org \
--to=e@80x24.org \
--cc=http_spew-public@bogomips.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://yhbt.net/http_spew.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox