diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2012-05-24 14:55:38 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2012-05-24 15:32:38 -0700 |
commit | d5dc462cd28c7787735ff9f571869eeb097e25f7 (patch) | |
tree | c0baf458a4042c6c4b46a9ab52323172715ca554 /railties/lib | |
parent | 317f49493afc92c7aab1b9b43a1214a1966106e2 (diff) | |
download | rails-d5dc462cd28c7787735ff9f571869eeb097e25f7.tar.gz rails-d5dc462cd28c7787735ff9f571869eeb097e25f7.tar.bz2 rails-d5dc462cd28c7787735ff9f571869eeb097e25f7.zip |
`name` should be public.
Diffstat (limited to 'railties/lib')
-rw-r--r-- | railties/lib/rails/generators/rails/plugin_new/plugin_new_generator.rb | 24 |
1 files changed, 12 insertions, 12 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 7088367462..ab0e440bc4 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 @@ -232,6 +232,18 @@ task :default => :test public_task :apply_rails_template, :run_bundle + def name + @name ||= begin + # same as ActiveSupport::Inflector#underscore except not replacing '-' + 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! + + underscored + end + end + protected def app_templates_dir @@ -268,18 +280,6 @@ task :default => :test @original_name ||= File.basename(destination_root) end - def name - @name ||= begin - # same as ActiveSupport::Inflector#underscore except not replacing '-' - 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! - - underscored - end - end - def camelized @camelized ||= name.gsub(/\W/, '_').squeeze('_').camelize end |