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/engine.rb | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'railties/lib/rails/engine.rb') diff --git a/railties/lib/rails/engine.rb b/railties/lib/rails/engine.rb index 7afb599910..2c2bb1c714 100644 --- a/railties/lib/rails/engine.rb +++ b/railties/lib/rails/engine.rb @@ -251,7 +251,7 @@ module Rails # # # config/routes.rb # MyApplication::Application.routes.draw do - # mount MyEngine::Engine => "/my_engine", :as => "my_engine" + # mount MyEngine::Engine => "/my_engine", as: "my_engine" # get "/foo" => "foo#index" # end # @@ -368,7 +368,7 @@ module Rails def isolate_namespace(mod) engine_name(generate_railtie_name(mod)) - self.routes.default_scope = { :module => ActiveSupport::Inflector.underscore(mod.name) } + self.routes.default_scope = { module: ActiveSupport::Inflector.underscore(mod.name) } self.isolated = true unless mod.respond_to?(:railtie_namespace) @@ -407,8 +407,8 @@ module Rails end end - delegate :middleware, :root, :paths, :to => :config - delegate :engine_name, :isolated?, :to => "self.class" + delegate :middleware, :root, :paths, to: :config + delegate :engine_name, :isolated?, to: "self.class" def initialize @_all_autoload_paths = nil @@ -536,7 +536,7 @@ module Rails end # Add configured load paths to ruby load paths and remove duplicates. - initializer :set_load_path, :before => :bootstrap_hook do + initializer :set_load_path, before: :bootstrap_hook do _all_load_paths.reverse_each do |path| $LOAD_PATH.unshift(path) if File.directory?(path) end @@ -548,7 +548,7 @@ module Rails # # This needs to be an initializer, since it needs to run once # per engine and get the engine as a block parameter - initializer :set_autoload_paths, :before => :bootstrap_hook do |app| + initializer :set_autoload_paths, before: :bootstrap_hook do |app| ActiveSupport::Dependencies.autoload_paths.unshift(*_all_autoload_paths) ActiveSupport::Dependencies.autoload_once_paths.unshift(*_all_autoload_once_paths) @@ -581,13 +581,13 @@ module Rails end end - initializer :load_environment_config, :before => :load_environment_hook, :group => :all do + initializer :load_environment_config, before: :load_environment_hook, group: :all do paths["config/environments"].existent.each do |environment| require environment end end - initializer :append_assets_path, :group => :all do |app| + initializer :append_assets_path, group: :all do |app| app.config.assets.paths.unshift(*paths["vendor/assets"].existent_directories) app.config.assets.paths.unshift(*paths["lib/assets"].existent_directories) app.config.assets.paths.unshift(*paths["app/assets"].existent_directories) -- cgit v1.2.3