Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Prefer do-end for multiline block #8774

Merged
merged 1 commit into from

3 participants

Gosha Arinich Steve Klabnik Carlos Antonio da Silva
Gosha Arinich

No description provided.

Carlos Antonio da Silva carlosantoniodasilva merged commit bdffd1e into from
Gosha Arinich goshakkk deleted the branch
Steve Klabnik
Collaborator

I don't care that this got merged, but wouldn't this fall under 'cosmetic' normally?

Carlos Antonio da Silva

@steveklabnik definitely, I just merged because 2 of the 3 changes were in guides, and I prefer do..end for multiline blocks, so I thought it'd be better to have the examples like that. If all changes were in code, I'd go for cosmetic.

Steve Klabnik
Collaborator

Roger! Just putting that away in the brain for future PRs. :+1:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jan 5, 2013
  1. Gosha Arinich
This page is out of date. Refresh to see the latest.
4 guides/source/initialization.md
View
@@ -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.
4 guides/source/rails_on_rack.md
View
@@ -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:
4 railties/lib/rails/commands.rb
View
@@ -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'
Something went wrong with that request. Please try again.