pryをインストールして使ってみます。
gem "pry"
require 'pry'
#..........
binding.pry
しかし、3つの問題があります:
- 次の文字列(次のブレークポイントではない)に移動するか、変数の値を監視するかがわかりません。それについての情報はありません!
- さまざまな詮索好きがたくさんあります!pry-debug、pry、pry-dbなど。どちらを使うべきですか?
- それはそこで止まるはずです。しかし、変数の値を監視する方法や次の行に進む方法はまだわかりません(そして見つかりませんでした)。そして、それは常に数秒で以下のようなエラーを出します:
pry(#)>エラー:実行期限が切れました /var/lib/gems/1.9.1/gems/pry-0.9.10/lib/pry/pry_instance.rb:600:in `getbyte ' /var/lib/gems/1.9.1/gems/pry-0.9.10/lib/pry/pry_instance.rb:600:in `readline ' /var/lib/gems/1.9.1/gems/pry-0.9.10/lib/pry/pry_instance.rb:600:in `block in readline ' /var/lib/gems/1.9.1/gems/pry-0.9.10/lib/pry/pry_instance.rb:544:in `handle_read_errors ' /var/lib/gems/1.9.1/gems/pry-0.9.10/lib/pry/pry_instance.rb:589:in `readline ' /var/lib/gems/1.9.1/gems/pry-0.9.10/lib/pry/pry_instance.rb:369:in `retrieve_line ' /var/lib/gems/1.9.1/gems/pry-0.9.10/lib/pry/pry_instance.rb:304:in `block in r ' /var/lib/gems/1.9.1/gems/pry-0.9.10/lib/pry/pry_instance.rb:301:in `loop ' /var/lib/gems/1.9.1/gems/pry-0.9.10/lib/pry/pry_instance.rb:301:in `r ' /var/lib/gems/1.9.1/gems/pry-0.9.10/lib/pry/pry_instance.rb:271:in `re ' /var/lib/gems/1.9.1/gems/pry-0.9.10/lib/pry/pry_instance.rb:251:in `rep ' /var/lib/gems/1.9.1/gems/pry-0.9.10/lib/pry/pry_instance.rb:231:in `ブロック(3レベル)in repl ' /var/lib/gems/1.9.1/gems/pry-0.9.10/lib/pry/pry_instance.rb:230:in `loop ' /var/lib/gems/1.9.1/gems/pry-0.9.10/lib/pry/pry_instance.rb:230:in `ブロック(2レベル)in repl ' /var/lib/gems/1.9.1/gems/pry-0.9.10/lib/pry/pry_instance.rb:229:in `catch ' /var/lib/gems/1.9.1/gems/pry-0.9.10/lib/pry/pry_instance.rb:229:in `block in repl ' /var/lib/gems/1.9.1/gems/pry-0.9.10/lib/pry/pry_instance.rb:228:in `catch ' /var/lib/gems/1.9.1/gems/pry-0.9.10/lib/pry/pry_instance.rb:228:in `repl ' /var/lib/gems/1.9.1/gems/pry-0.9.10/lib/pry/pry_class.rb:154:in `start ' /var/lib/gems/1.9.1/gems/pry-0.9.10/lib/pry/core_extensions.rb:22:in `pry ' /home/alex/Documents/ruby/my_projects/controllers/my_controller.rb:24:in `block in ' /var/lib/gems/1.9.1/gems/sinatra-1.3.3/lib/sinatra/base.rb:1265:in `call ' /var/lib/gems/1.9.1/gems/sinatra-1.3.3/lib/sinatra/base.rb:1265:in `block in compile! ' /var/lib/gems/1.9.1/gems/sinatra-1.3.3/lib/sinatra/base.rb:835:in `[] ' /var/lib/gems/1.9.1/gems/sinatra-1.3.3/lib/sinatra/base.rb:835:in `ブロック(3レベル)でルート中! ' /var/lib/gems/1.9.1/gems/sinatra-1.3.3/lib/sinatra/base.rb:851:in `route_eval ' /var/lib/gems/1.9.1/gems/sinatra-1.3.3/lib/sinatra/base.rb:835:in `ブロック(2レベル)でルート中! ' /var/lib/gems/1.9.1/gems/sinatra-1.3.3/lib/sinatra/base.rb:872:in `block in process_route ' /var/lib/gems/1.9.1/gems/sinatra-1.3.3/lib/sinatra/base.rb:870:in `catch ' /var/lib/gems/1.9.1/gems/sinatra-1.3.3/lib/sinatra/base.rb:870:in `process_route ' /var/lib/gems/1.9.1/gems/sinatra-1.3.3/lib/sinatra/base.rb:834:in `block in route! ' /var/lib/gems/1.9.1/gems/sinatra-1.3.3/lib/sinatra/base.rb:833:in `each ' /var/lib/gems/1.9.1/gems/sinatra-1.3.3/lib/sinatra/base.rb:833:in `route! ' /var/lib/gems/1.9.1/gems/sinatra-1.3.3/lib/sinatra/base.rb:936:in `dispatch! ' /var/lib/gems/1.9.1/gems/sinatra-1.3.3/lib/sinatra/base.rb:769:in `block in call! ' /var/lib/gems/1.9.1/gems/sinatra-1.3.3/lib/sinatra/base.rb:921:in `block in invoke ' /var/lib/gems/1.9.1/gems/sinatra-1.3.3/lib/sinatra/base.rb:921:in `catch ' /var/lib/gems/1.9.1/gems/sinatra-1.3.3/lib/sinatra/base.rb:921:in `invoke ' /var/lib/gems/1.9.1/gems/sinatra-1.3.3/lib/sinatra/base.rb:769:in `call! ' /home/alex/Documents/ruby/my_projects/app.rb:21:in `block in ' /var/lib/gems/1.9.1/gems/sinatra-1.3.3/lib/sinatra/base.rb:1265:in `call ' /var/lib/gems/1.9.1/gems/sinatra-1.3.3/lib/sinatra/base.rb:1265:in `block in compile! ' /var/lib/gems/1.9.1/gems/sinatra-1.3.3/lib/sinatra/base.rb:835:in `[] ' /var/lib/gems/1.9.1/gems/sinatra-1.3.3/lib/sinatra/base.rb:835:in `ブロック(3レベル)でルート中! ' /var/lib/gems/1.9.1/gems/sinatra-1.3.3/lib/sinatra/base.rb:851:in `route_eval ' /var/lib/gems/1.9.1/gems/sinatra-1.3.3/lib/sinatra/base.rb:835:in `ブロック(2レベル)でルート中! ' /var/lib/gems/1.9.1/gems/sinatra-1.3.3/lib/sinatra/base.rb:872:in `block in process_route ' /var/lib/gems/1.9.1/gems/sinatra-1.3.3/lib/sinatra/base.rb:870:in `catch ' /var/lib/gems/1.9.1/gems/sinatra-1.3.3/lib/sinatra/base.rb:870:in `process_route ' /var/lib/gems/1.9.1/gems/sinatra-1.3.3/lib/sinatra/base.rb:834:in `block in route! ' /var/lib/gems/1.9.1/gems/sinatra-1.3.3/lib/sinatra/base.rb:833:in `each ' /var/lib/gems/1.9.1/gems/sinatra-1.3.3/lib/sinatra/base.rb:833:in `route! ' /var/lib/gems/1.9.1/gems/sinatra-1.3.3/lib/sinatra/base.rb:936:in `dispatch! ' /var/lib/gems/1.9.1/gems/sinatra-1.3.3/lib/sinatra/base.rb:769:in `block in call! ' /var/lib/gems/1.9.1/gems/sinatra-1.3.3/lib/sinatra/base.rb:921:in `block in invoke ' /var/lib/gems/1.9.1/gems/sinatra-1.3.3/lib/sinatra/base.rb:921:in `catch ' /var/lib/gems/1.9.1/gems/sinatra-1.3.3/lib/sinatra/base.rb:921:in `invoke ' /var/lib/gems/1.9.1/gems/sinatra-1.3.3/lib/sinatra/base.rb:769:in `call! ' /var/lib/gems/1.9.1/gems/sinatra-1.3.3/lib/sinatra/base.rb:755:in `call ' /var/lib/gems/1.9.1/gems/rack-flash3-1.0.1/lib/rack/flash.rb:120:in `call ' /var/lib/gems/1.9.1/gems/rack-timeout-0.0.3/lib/rack/timeout.rb:16:in `block in call ' /usr/lib/ruby/1.9.1/timeout.rb:68:in `timeout ' /var/lib/gems/1.9.1/gems/rack-timeout-0.0.3/lib/rack/timeout.rb:16:in `call ' /var/lib/gems/1.9.1/gems/rack-1.4.1/lib/rack/session/abstract/id.rb:205:in `context ' /var/lib/gems/1.9.1/gems/rack-1.4.1/lib/rack/session/abstract/id.rb:200:in `call ' /var/lib/gems/1.9.1/gems/rack-protection-1.2.0/lib/rack/protection/xss_header.rb:22:in `call ' /var/lib/gems/1.9.1/gems/rack-protection-1.2.0/lib/rack/protection/path_traversal.rb:16:in `call ' /var/lib/gems/1.9.1/gems/rack-protection-1.2.0/lib/rack/protection/json_csrf.rb:17:in `call ' /var/lib/gems/1.9.1/gems/rack-protection-1.2.0/lib/rack/protection/base.rb:47:in `call ' /var/lib/gems/1.9.1/gems/rack-protection-1.2.0/lib/rack/protection/xss_header.rb:22:in `call ' /var/lib/gems/1.9.1/gems/rack-1.4.1/lib/rack/logger.rb:15:in `call ' /var/lib/gems/1.9.1/gems/sinatra-1.3.3/lib/sinatra/base.rb:129:in `call ' /var/lib/gems/1.9.1/gems/rack-1.4.1/lib/rack/head.rb:9:in `call ' /var/lib/gems/1.9.1/gems/rack-1.4.1/lib/rack/methodoverride.rb:21:in `call ' /var/lib/gems/1.9.1/gems/sinatra-1.3.3/lib/sinatra/showexceptions.rb:21:in `call ' /var/lib/gems/1.9.1/gems/sinatra-1.3.3/lib/sinatra/base.rb:99:in `call ' /var/lib/gems/1.9.1/gems/sinatra-1.3.3/lib/sinatra/base.rb:1389:in `block in call ' /var/lib/gems/1.9.1/gems/sinatra-1.3.3/lib/sinatra/base.rb:1471:in `synchronize ' /var/lib/gems/1.9.1/gems/sinatra-1.3.3/lib/sinatra/base.rb:1389:in `call ' /var/lib/gems/1.9.1/gems/rack-1.4.1/lib/rack/builder.rb:134:in `call ' /var/lib/gems/1.9.1/gems/rack-1.4.1/lib/rack/urlmap.rb:64:in `block in call ' /var/lib/gems/1.9.1/gems/rack-1.4.1/lib/rack/urlmap.rb:49:in `each ' /var/lib/gems/1.9.1/gems/rack-1.4.1/lib/rack/urlmap.rb:49:in `call ' /var/lib/gems/1.9.1/gems/rack-1.4.1/lib/rack/lint.rb:48:in `_call ' /var/lib/gems/1.9.1/gems/rack-1.4.1/lib/rack/lint.rb:36:in `call ' /var/lib/gems/1.9.1/gems/rack-1.4.1/lib/rack/showexceptions.rb:24:in `call ' /var/lib/gems/1.9.1/gems/rack-1.4.1/lib/rack/commonlogger.rb:20:in `call ' /var/lib/gems/1.9.1/gems/sinatra-1.3.3/lib/sinatra/base.rb:136:in `call ' /var/lib/gems/1.9.1/gems/rack-1.4.1/lib/rack/chunked.rb:43:in `call ' /var/lib/gems/1.9.1/gems/rack-1.4.1/lib/rack/content_length.rb:14:in `call ' /var/lib/gems/1.9.1/gems/rack-1.4.1/lib/rack/handler/webrick.rb:59:in `service ' /usr/lib/ruby/1.9.1/webrick/httpserver.rb:138:in `service ' /usr/lib/ruby/1.9.1/webrick/httpserver.rb:94:in `run ' /usr/lib/ruby/1.9.1/webrick/server.rb:191:in `block in start_thread ' pry(#)>
了解しました。インストールします
gem "debugger"
ブレークポイントを追加します
debugger
何も起こりません。
ログファイルは私が探しているものではありません。Sinatraアプリケーションをデバッグしたいだけです。それ、どうやったら出来るの?