Skip to content

Instantly share code, notes, and snippets.

@maasha
Created April 16, 2015 15:47
Show Gist options
  • Save maasha/cf9fcb41903d846bee14 to your computer and use it in GitHub Desktop.
Save maasha/cf9fcb41903d846bee14 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
str = 'one two three'
str = str.gsub(/t/) do |match|
match = 'X'
end
puts str
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