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

ruby-changes:51204

From: nobu <ko1@a...>
Date: Sun, 13 May 2018 10:18:44 +0900 (JST)
Subject: [ruby-changes:51204] nobu:r63411 (trunk): optparse.rb: Remove redundant `.freeze`

nobu	2018-05-13 10:18:33 +0900 (Sun, 13 May 2018)

  New Revision: 63411

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

  Log:
    optparse.rb: Remove redundant `.freeze`
    
    [Fix GH-1873]
    
    From: Masataka Pocke Kuwabara <kuwabara@p...>

  Modified files:
    trunk/lib/optparse.rb
Index: lib/optparse.rb
===================================================================
--- lib/optparse.rb	(revision 63410)
+++ lib/optparse.rb	(revision 63411)
@@ -436,7 +436,7 @@ class OptionParser https://github.com/ruby/ruby/blob/trunk/lib/optparse.rb#L436
       candidates = []
       block.call do |k, *v|
         (if Regexp === k
-           kn = "".freeze
+           kn = ""
            k === key
          else
            kn = defined?(k.id2name) ? k.id2name : k
@@ -1976,7 +1976,7 @@ XXX https://github.com/ruby/ruby/blob/trunk/lib/optparse.rb#L1976
   #
   class ParseError < RuntimeError
     # Reason which caused the error.
-    Reason = 'parse error'.freeze
+    Reason = 'parse error'
 
     def initialize(*args)
       @args = args
@@ -2039,42 +2039,42 @@ XXX https://github.com/ruby/ruby/blob/trunk/lib/optparse.rb#L2039
   # Raises when ambiguously completable string is encountered.
   #
   class AmbiguousOption < ParseError
-    const_set(:Reason, 'ambiguous option'.freeze)
+    const_set(:Reason, 'ambiguous option')
   end
 
   #
   # Raises when there is an argument for a switch which takes no argument.
   #
   class NeedlessArgument < ParseError
-    const_set(:Reason, 'needless argument'.freeze)
+    const_set(:Reason, 'needless argument')
   end
 
   #
   # Raises when a switch with mandatory argument has no argument.
   #
   class MissingArgument < ParseError
-    const_set(:Reason, 'missing argument'.freeze)
+    const_set(:Reason, 'missing argument')
   end
 
   #
   # Raises when switch is undefined.
   #
   class InvalidOption < ParseError
-    const_set(:Reason, 'invalid option'.freeze)
+    const_set(:Reason, 'invalid option')
   end
 
   #
   # Raises when the given argument does not match required format.
   #
   class InvalidArgument < ParseError
-    const_set(:Reason, 'invalid argument'.freeze)
+    const_set(:Reason, 'invalid argument')
   end
 
   #
   # Raises when the given argument word can't be completed uniquely.
   #
   class AmbiguousArgument < InvalidArgument
-    const_set(:Reason, 'ambiguous argument'.freeze)
+    const_set(:Reason, 'ambiguous argument')
   end
 
   #

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

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