Ruby mogilefs-client dev/users discussion/patches/bugs/help/...
 help / color / mirror / code / Atom feed
From: Eric Wong <e@80x24.org>
To: mogilefs-client-public@bogomips.org
Subject: [PATCH 3/3] new_file/common: simplify empty class declarations
Date: Thu, 29 Dec 2016 07:42:15 +0000	[thread overview]
Message-ID: <20161229074215.12425-4-e@80x24.org> (raw)
In-Reply-To: <20161229074215.12425-1-e@80x24.org>

This compiles to smaller bytecode on YARV (MRI)
---
 lib/mogilefs/new_file/common.rb | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/lib/mogilefs/new_file/common.rb b/lib/mogilefs/new_file/common.rb
index 44eee69..d696072 100644
--- a/lib/mogilefs/new_file/common.rb
+++ b/lib/mogilefs/new_file/common.rb
@@ -7,14 +7,14 @@
 
 module MogileFS::NewFile::Common
   # :stopdoc:
-  class RetryableError < MogileFS::Error; end
-  class EmptyResponseError < RetryableError; end
-  class BadResponseError < RetryableError; end
-  class UnparseableResponseError < RetryableError; end
+  RetryableError = Class.new(MogileFS::Error)
+  EmptyResponseError = Class.new(RetryableError)
+  BadResponseError = Class.new(RetryableError)
+  UnparseableResponseError = Class.new(RetryableError)
   class NoStorageNodesError < MogileFS::Error
     def message; 'Unable to open socket to storage node'; end
   end
-  class NonRetryableError < MogileFS::Error; end
+  NonRetryableError = Class.new(MogileFS::Error)
 
   MD5_TRAILER_NODES = {} # :nodoc: # EXPERIMENTAL
 
-- 
EW


      parent reply	other threads:[~2016-12-29  7:42 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-29  7:42 [PATCH 0/3] misc cleanups Eric Wong
2016-12-29  7:42 ` [PATCH 1/3] avoid pointless capture in regexp Eric Wong
2016-12-29  7:42 ` [PATCH 2/3] use opt_str_freeze to avoid allocations in a few places Eric Wong
2016-12-29  7:42 ` Eric Wong [this message]

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/mogilefs-client/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161229074215.12425-4-e@80x24.org \
    --to=e@80x24.org \
    --cc=mogilefs-client-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/mogilefs-client.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).