Skip to content

Commit de055a2

Browse files
committed
Use symbols as level instead of strings
1 parent 87a71ac commit de055a2

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

lib/bundled_gems.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -119,24 +119,24 @@ def self.warning?(name, specs: nil)
119119
return if WARNED[name]
120120
WARNED[name] = true
121121

122-
level = RUBY_VERSION < SINCE[name] ? "warning" : "error"
122+
level = RUBY_VERSION < SINCE[name] ? :warning : :error
123123

124124
if subfeature
125125
"#{feature} is found in #{name}, which"
126126
else
127-
"#{feature} #{level == "warning" ? "was loaded" : "used to be loaded"} from the standard library, but"
127+
"#{feature} #{level == :warning ? "was loaded" : "used to be loaded"} from the standard library, but"
128128
end + build_message(name, level)
129129
end
130130

131131
def self.build_message(name, level)
132-
msg = if level == "warning"
132+
msg = if level == :warning
133133
" will no longer be part of the default gems starting from Ruby #{SINCE[name]}"
134134
else
135135
" is not part of the default gems since Ruby #{SINCE[name]}."
136136
end
137137

138138
if defined?(Bundler)
139-
motivation = level == "warning" ? "silence this warning" : "fix this error"
139+
motivation = level == :warning ? "silence this warning" : "fix this error"
140140
msg += "\nYou can add #{name} to your Gemfile or gemspec to #{motivation}."
141141

142142
# We detect the gem name from caller_locations. First we walk until we find `require`
@@ -231,7 +231,7 @@ def message # :nodoc:
231231

232232
name = path.tr("/", "-")
233233
if !defined?(Bundler) && Gem::BUNDLED_GEMS::SINCE[name] && !Gem::BUNDLED_GEMS::WARNED[name]
234-
warn name + Gem::BUNDLED_GEMS.build_message(name, "error"), uplevel: Gem::BUNDLED_GEMS.uplevel
234+
warn name + Gem::BUNDLED_GEMS.build_message(name, :error), uplevel: Gem::BUNDLED_GEMS.uplevel
235235
end
236236
super
237237
end

0 commit comments

Comments
 (0)