Permalink
Browse files

Merge pull request #8774 from goshakkk/multiline-block-do-end

Prefer do-end for multiline block [ci skip]
  • Loading branch information...
2 parents 2516a1d + 732d350 commit bdffd1e884593adc40fb30bd7c05661a668fc897 @carlosantoniodasilva carlosantoniodasilva committed Jan 6, 2013
Showing with 6 additions and 6 deletions.
  1. +2 −2 guides/source/initialization.md
  2. +2 −2 guides/source/rails_on_rack.md
  3. +2 −2 railties/lib/rails/commands.rb
@@ -232,13 +232,13 @@ when 'server'
Dir.chdir(File.expand_path('../../', APP_PATH)) unless File.exists?(File.expand_path("config.ru"))
require 'rails/commands/server'
- Rails::Server.new.tap { |server|
+ Rails::Server.new.tap do |server|
# We need to require application after the server sets environment,
# otherwise the --environment option given to the server won't propagate.
require APP_PATH
Dir.chdir(Rails.application.root)
server.start
- }
+ end
```
This file will change into the root of the directory (a path two directories back from `APP_PATH` which points at `config/application.rb`), but only if the `config.ru` file isn't found. This then requires `rails/commands/server` which sets up the `Rails::Server` class.
@@ -37,11 +37,11 @@ Rails on Rack
Here's how `rails server` creates an instance of `Rack::Server`
```ruby
-Rails::Server.new.tap { |server|
+Rails::Server.new.tap do |server|
require APP_PATH
Dir.chdir(Rails.application.root)
server.start
-}
+end
```
The `Rails::Server` inherits from `Rack::Server` and calls the `Rack::Server#start` method this way:
@@ -77,13 +77,13 @@
Dir.chdir(File.expand_path('../../', APP_PATH)) unless File.exists?(File.expand_path("config.ru"))
require 'rails/commands/server'
- Rails::Server.new.tap { |server|
+ Rails::Server.new.tap do |server|
# We need to require application after the server sets environment,
# otherwise the --environment option given to the server won't propagate.
require APP_PATH
Dir.chdir(Rails.application.root)
server.start
- }
+ end
when 'dbconsole'
require 'rails/commands/dbconsole'

0 comments on commit bdffd1e

Please sign in to comment.