From 5ad7f8ab418f0c760dbb584f7c78d94ce32e9ee3 Mon Sep 17 00:00:00 2001 From: Robin Dupret Date: Sun, 14 Oct 2012 12:03:39 +0200 Subject: Use Ruby 1.9 Hash syntax in railties --- railties/lib/rails/generators/base.rb | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'railties/lib/rails/generators/base.rb') diff --git a/railties/lib/rails/generators/base.rb b/railties/lib/rails/generators/base.rb index 5ca1bfc20f..7e938fab47 100644 --- a/railties/lib/rails/generators/base.rb +++ b/railties/lib/rails/generators/base.rb @@ -61,7 +61,7 @@ module Rails # # module Rails::Generators # class ControllerGenerator < Base - # hook_for :test_framework, :aliases => "-t" + # hook_for :test_framework, aliases: "-t" # end # end # @@ -102,7 +102,7 @@ module Rails # :as option: # # class AwesomeGenerator < Rails::Generators::Base - # hook_for :test_framework, :as => :controller + # hook_for :test_framework, as: :controller # end # # And now it will lookup at: @@ -113,7 +113,7 @@ module Rails # need to provide the :base value: # # class AwesomeGenerator < Rails::Generators::Base - # hook_for :test_framework, :in => :rails, :as => :controller + # hook_for :test_framework, in: :rails, as: :controller # end # # And the lookup is exactly the same as previously: @@ -137,7 +137,7 @@ module Rails # developers might want to have webrat available on controller generator. # This can be achieved as: # - # Rails::Generators::ControllerGenerator.hook_for :webrat, :type => :boolean + # Rails::Generators::ControllerGenerator.hook_for :webrat, type: :boolean # # Then, if you want webrat to be invoked, just supply: # @@ -171,9 +171,9 @@ module Rails defaults = if options[:type] == :boolean { } elsif [true, false].include?(default_value_for_option(name, options)) - { :banner => "" } + { banner: "" } else - { :desc => "#{name.to_s.humanize} to be invoked", :banner => "NAME" } + { desc: "#{name.to_s.humanize} to be invoked", banner: "NAME" } end unless class_options.key?(name) @@ -343,8 +343,8 @@ module Rails # Small macro to add ruby as an option to the generator with proper # default value plus an instance helper method called shebang. def self.add_shebang_option! - class_option :ruby, :type => :string, :aliases => "-r", :default => Thor::Util.ruby_command, - :desc => "Path to the Ruby binary of your choice", :banner => "PATH" + class_option :ruby, type: :string, aliases: "-r", default: Thor::Util.ruby_command, + desc: "Path to the Ruby binary of your choice", banner: "PATH" no_tasks { define_method :shebang do -- cgit v1.2.3