Permalink
Browse files

fix warning about instance variable in plugin generator

  • Loading branch information...
1 parent 39d2251 commit c220b4d833fcefb4f60fd021875c05e07dfff77d @lest lest committed Nov 19, 2011
Showing with 7 additions and 7 deletions.
  1. +7 −7 railties/lib/rails/generators/rails/plugin_new/plugin_new_generator.rb
View
14 railties/lib/rails/generators/rails/plugin_new/plugin_new_generator.rb
@@ -251,15 +251,15 @@ def original_name
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

0 comments on commit c220b4d

Please sign in to comment.