diff options
Diffstat (limited to 'railties/lib')
-rw-r--r-- | railties/lib/rails/generators/rails/plugin_new/plugin_new_generator.rb | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/railties/lib/rails/generators/rails/plugin_new/plugin_new_generator.rb b/railties/lib/rails/generators/rails/plugin_new/plugin_new_generator.rb index ff523fc26f..cd7d51e628 100644 --- a/railties/lib/rails/generators/rails/plugin_new/plugin_new_generator.rb +++ b/railties/lib/rails/generators/rails/plugin_new/plugin_new_generator.rb @@ -251,15 +251,15 @@ task :default => :test end def name - unless @name + @name ||= begin # same as ActiveSupport::Inflector#underscore except not replacing '-' - @name = original_name.dup - @name.gsub!(/([A-Z]+)([A-Z][a-z])/,'\1_\2') - @name.gsub!(/([a-z\d])([A-Z])/,'\1_\2') - @name.downcase! - end + underscored = original_name.dup + underscored.gsub!(/([A-Z]+)([A-Z][a-z])/,'\1_\2') + underscored.gsub!(/([a-z\d])([A-Z])/,'\1_\2') + underscored.downcase! - @name + underscored + end end def camelized |