Skip to content

Instantly share code, notes, and snippets.

@bastjan
Created January 17, 2017 15:40
Show Gist options
  • Save bastjan/5be7a79fcafe210c92ed11424d138074 to your computer and use it in GitHub Desktop.
Save bastjan/5be7a79fcafe210c92ed11424d138074 to your computer and use it in GitHub Desktop.
replace our Hash#dig with ruby2.3 Hash#dig
file_names = Dir.glob("**/*.rb")
file_names.each do |file_name|
content = File.read(file_name)
new_content = content.gsub(/\.dig\('([^']+)'\)/) { |function| function.gsub(/(.)\.(.)/, '\1\', \'\2' ) }
File.open(file_name, "w") {|file| file.puts new_content }
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment