Skip to content

Commit 08936f9

Browse files
committed
(MAINT) Rubocop: Fix Performance/RegexpMatch
1 parent 1b30b4d commit 08936f9

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

Diff for: Rakefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ PuppetLint.configuration.ignore_paths = %w(acceptance/**/*.pp spec/**/*.pp pkg/*
5656
desc 'Validate Ruby source files and ERB templates.'
5757
task :validate do
5858
Dir['spec/**/*.rb','lib/**/*.rb'].each do |ruby_file|
59-
sh "ruby -c #{ruby_file}" unless ruby_file =~ /spec\/fixtures/
59+
sh "ruby -c #{ruby_file}" unless /spec\/fixtures/.match?(ruby_file)
6060
end
6161
Dir['lib/puppet-strings/yard/templates/**/*.erb'].each do |template|
6262
sh "erb -P -x -T '-' #{template} | ruby -c"

Diff for: lib/puppet-strings/markdown/function.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ def render
2121

2222
def type
2323
t = @registry[:type]
24-
if t =~ /ruby4x/
24+
if /ruby4x/.match?(t)
2525
"Ruby 4.x API"
26-
elsif t =~ /ruby3/
26+
elsif /ruby3/.match?(t)
2727
"Ruby 3.x API"
28-
elsif t =~ /ruby/
28+
elsif /ruby/.match?(t)
2929
"Ruby"
3030
else
3131
"Puppet Language"

Diff for: lib/puppet/face/strings.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@
148148
def check_required_features
149149
raise RuntimeError, "The 'yard' gem must be installed in order to use this face." unless Puppet.features.yard?
150150
raise RuntimeError, "The 'rgen' gem must be installed in order to use this face." unless Puppet.features.rgen?
151-
raise RuntimeError, 'This face requires Ruby 1.9 or greater.' if RUBY_VERSION =~ /^1\.8/
151+
raise RuntimeError, 'This face requires Ruby 1.9 or greater.' if RUBY_VERSION.match?(/^1\.8/)
152152
end
153153

154154
# Builds the options to PuppetStrings.generate.

0 commit comments

Comments
 (0)