From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.0 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id CB57A202FB for ; Sun, 5 Mar 2017 23:13:18 +0000 (UTC) From: Eric Wong To: kcar-public@bogomips.org Subject: [PATCH 3/6] response: remove unnecessary constant alias Date: Sun, 5 Mar 2017 23:13:13 +0000 Message-Id: <20170305231316.8645-4-kcar-public@bogomips.org> In-Reply-To: <20170305231316.8645-1-kcar-public@bogomips.org> References: <20170305231316.8645-1-kcar-public@bogomips.org> List-Id: Constant lookups are inline-cached in modern Rubies, so this is a waste of memory. --- lib/kcar/response.rb | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/lib/kcar/response.rb b/lib/kcar/response.rb index c74bb4b..af15ca0 100644 --- a/lib/kcar/response.rb +++ b/lib/kcar/response.rb @@ -6,10 +6,6 @@ class Kcar::Response attr_accessor :sock, :hdr, :unchunk, :buf, :parser - # :stopdoc: - Parser = Kcar::Parser - # :startdoc: - # By default we readpartial at most 16K off a socket at once READ_SIZE = 0x4000 @@ -17,7 +13,8 @@ class Kcar::Response # method. +unchunk+ may be set to disable transparent unchunking # +hdr+ may be a Hash, Array, or Rack::Utils::HeaderHash def initialize(sock, hdr = {}, unchunk = true) - @sock, @hdr, @unchunk, @buf, @parser = sock, hdr, unchunk, "", Parser.new + @sock, @hdr, @unchunk, @buf = sock, hdr, unchunk, "" + @parser = Kcar::Parser.new end # returns a 3-element array that resembles a Rack response, but is -- EW