12. Rackミドルウェアを作ってみよう class UpcaseAll def initialize(app) @app = app end def call(env) code, headers, body = @app.call(env) body.each {|part| part.upcase! } [code, headers, body] end end class RackApp #... end use UpcaseAll run RackApp.new config.ru
Ruby on Railsというフレームワークを使うとrails new Hogeとかでアプリケーションのひな形ができちゃって、rails serverでサーバーが立ち上げられたりするわけですが、これは一体どうなってるんだというのを追っていけたらなと思います。誰にでもわかるように書きたいです。今回こそはくじけずに書ききりたい。 railsとbin/railsの違い railsはシステムにインストールされたrailsコマンドを呼ぶ(/Users/ユーザー名/.rbenv/shims/railsみたいな)。 bin/railsはそのプロジェクト下のbin/railsのコマンドを呼ぶ。 bin/rails Railsプロジェクトを作ると、binというディレクトリの中にrailsというファイルがある。これをエディタで開いてみる。 $ vim bin/rails 中身はこんな感じ。 #!/usr/b
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く