[前][次][番号順一覧][スレッド一覧]

ruby-changes:40210

From: nobu <ko1@a...>
Date: Mon, 26 Oct 2015 23:51:27 +0900 (JST)
Subject: [ruby-changes:40210] nobu:r52291 (trunk): logger.rb: freeze constants

nobu	2015-10-26 23:51:04 +0900 (Mon, 26 Oct 2015)

  New Revision: 52291

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=52291

  Log:
    logger.rb: freeze constants
    
    * lib/logger.rb: freeze constant strings and array.

  Modified files:
    trunk/lib/logger.rb
Index: lib/logger.rb
===================================================================
--- lib/logger.rb	(revision 52290)
+++ lib/logger.rb	(revision 52291)
@@ -208,7 +208,7 @@ class Logger https://github.com/ruby/ruby/blob/trunk/lib/logger.rb#L208
     name = File.basename(__FILE__)
   end
   rev ||= "v#{VERSION}"
-  ProgName = "#{name}/#{rev}"
+  ProgName = "#{name}/#{rev}".freeze
 
   class Error < RuntimeError # :nodoc:
   end
@@ -481,7 +481,7 @@ class Logger https://github.com/ruby/ruby/blob/trunk/lib/logger.rb#L481
 private
 
   # Severity label for logging (max 5 chars).
-  SEV_LABEL = %w(DEBUG INFO WARN ERROR FATAL ANY)
+  SEV_LABEL = %w(DEBUG INFO WARN ERROR FATAL ANY).each(&:freeze).freeze
 
   def format_severity(severity)
     SEV_LABEL[severity] || 'ANY'
@@ -494,7 +494,7 @@ private https://github.com/ruby/ruby/blob/trunk/lib/logger.rb#L494
 
   # Default formatter for log messages.
   class Formatter
-    Format = "%s, [%s#%d] %5s -- %s: %s\n"
+    Format = "%s, [%s#%d] %5s -- %s: %s\n".freeze
 
     attr_accessor :datetime_format
 

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]