Created
March 2, 2018 04:43
-
-
Save kyubuns/1d38e73c711806105d07023621f940b7 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
class String | |
def snakecase | |
#gsub(/::/, '/'). | |
gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2'). | |
gsub(/([a-z\d])([A-Z])/,'\1_\2'). | |
tr('-', '_'). | |
gsub(/\s/, '_'). | |
gsub(/__+/, '_'). | |
downcase | |
end | |
alias_method :underscore, :snakecase | |
end | |
Dir.glob('Asset Bundles/*.meta').each do |file_path| | |
file = File.read(file_path) | |
name = File.basename(file_path).gsub(/.meta/, "").snakecase | |
file = file.gsub(/assetBundleName: \n/, "assetBundleName: #{name}\n") | |
File.write(file_path, file) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment