-
-
Save maasha/cf9fcb41903d846bee14 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
str = 'one two three' | |
str = str.gsub(/t/) do |match| | |
match = 'X' | |
end | |
puts str |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rubocop test.rb | |
Inspecting 1 file | |
W | |
Offenses: | |
test.rb:5:25: W: Unused block argument - match. You can omit the argument if you don't care about it. | |
str = str.gsub(/t/) do |match| | |
^^^^^ | |
test.rb:6:3: W: Useless assignment to variable - match. | |
match = 'X' | |
^^^^^ | |
1 file inspected, 2 offenses detected |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment