Code cleanup, improved String.to_filename.
This commit is contained in:
parent
644ecc6ef8
commit
9a702b528c
2 changed files with 7 additions and 4 deletions
|
@ -32,7 +32,10 @@ class String
|
|||
|
||||
def to_filename
|
||||
camel_cased_word = "#{self}"
|
||||
camel_cased_word.gsub(/::/, '/').downcase
|
||||
camel_cased_word.gsub(/::/, '/')
|
||||
.gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2')
|
||||
.gsub(/([a-z\d])([A-Z])/, '\1_\2')
|
||||
.tr('-', '_').downcase
|
||||
end
|
||||
|
||||
=begin
|
||||
|
|
Loading…
Reference in a new issue