Skip to content
This repository
Browse code

fix warning about instance variable in plugin generator

  • Loading branch information...
commit c220b4d833fcefb4f60fd021875c05e07dfff77d 1 parent 39d2251
Sergey Nartimov authored November 19, 2011
14  railties/lib/rails/generators/rails/plugin_new/plugin_new_generator.rb
@@ -251,15 +251,15 @@ def original_name
251 251
       end
252 252
 
253 253
       def name
254  
-        unless @name
  254
+        @name ||= begin
255 255
           # same as ActiveSupport::Inflector#underscore except not replacing '-'
256  
-          @name = original_name.dup
257  
-          @name.gsub!(/([A-Z]+)([A-Z][a-z])/,'\1_\2')
258  
-          @name.gsub!(/([a-z\d])([A-Z])/,'\1_\2')
259  
-          @name.downcase!
260  
-        end
  256
+          underscored = original_name.dup
  257
+          underscored.gsub!(/([A-Z]+)([A-Z][a-z])/,'\1_\2')
  258
+          underscored.gsub!(/([a-z\d])([A-Z])/,'\1_\2')
  259
+          underscored.downcase!
261 260
 
262  
-        @name
  261
+          underscored
  262
+        end
263 263
       end
264 264
 
265 265
       def camelized

0 notes on commit c220b4d

Please sign in to comment.
Something went wrong with that request. Please try again.