From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-2.9 required=3.0 tests=ALL_TRUSTED,AWL,BAYES_00 shortcircuit=no autolearn=unavailable version=3.3.2 X-Original-To: yahns-public@yhbt.net Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 5857A1F71E; Wed, 22 Apr 2015 00:59:30 +0000 (UTC) From: Eric Wong To: yahns-public@yhbt.net Cc: Eric Wong Subject: [PATCH] config: avoid unnecessary binmode call Date: Wed, 22 Apr 2015 00:59:28 +0000 Message-Id: <1429664368-30468-1-git-send-email-e@80x24.org> List-Id: We may set binary mode upon open by passing "b" in the mode string, so avoid the extra method dispatch and bytecode/cache overhead that entails. --- lib/yahns/config.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/yahns/config.rb b/lib/yahns/config.rb index 9db0d59..f4164a9 100644 --- a/lib/yahns/config.rb +++ b/lib/yahns/config.rb @@ -400,9 +400,8 @@ def errors(val) var = _check_in_block(:app, :errors) if String === val # we've already bound working_directory by the time we get here - val = File.open(File.expand_path(val), "a") + val = File.open(File.expand_path(val), "ab") val.close_on_exec = val.sync = true - val.binmode else rt = [ :puts, :write, :flush ] # match Rack::Lint rt.all? { |m| val.respond_to?(m) } or raise ArgumentError, -- 2.3.2.465.ga3b75b3