1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

optparse.rb: Remove redundant .freeze

[Fix GH-1873]

From: Masataka Pocke Kuwabara <kuwabara@pocke.me>

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63411 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2018-05-13 01:18:33 +00:00
parent 5c0e6cc886
commit 2c091f564c

View file

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