{"id":116667,"date":"2023-12-12T09:28:09","date_gmt":"2023-12-12T00:28:09","guid":{"rendered":"https:\/\/softantenna.com\/blog\/?p=116667"},"modified":"2023-12-12T09:28:09","modified_gmt":"2023-12-12T00:28:09","slug":"ruby-script-debugger","status":"publish","type":"post","link":"https:\/\/softantenna.com\/blog\/ruby-script-debugger\/","title":{"rendered":"\u3010Tips\u3011\u958b\u767a\u8005\u5fc5\u898b\uff01Ruby\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u6a19\u6e96\u6a5f\u80fd\u3067\u30c7\u30d0\u30c3\u30b0\u3059\u308b\u30b7\u30f3\u30d7\u30eb\u306a\u65b9\u6cd5"},"content":{"rendered":"<p><img decoding=\"async\" style=\"display:block; margin-left:auto; margin-right:auto;\" src=\"https:\/\/softantenna.com\/blog\/wp-content\/uploads\/2023\/12\/s_20231211_130147.jpg\" alt=\"S 20231211 130147\" title=\"s_20231211_130147.jpg\" border=\"0\" width=\"860\" height=\"560\" \/><\/p>\n<p>\u30d7\u30ed\u30b0\u30e9\u30e0\u306b\u30d0\u30b0\u306f\u3064\u304d\u3082\u306e\u3067\u3001\u30d0\u30b0\u3092\u89e3\u6d88\u3059\u308b\u305f\u3081\u306b\u306f\u30c7\u30d0\u30c3\u30b0\u4f5c\u696d\u304c\u5fc5\u8981\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>Ruby\u3067\u306f\u30a4\u30f3\u30bf\u30e9\u30af\u30c6\u30a3\u30d6\u306b\u30c7\u30d0\u30c3\u30b0\u3059\u308b\u305f\u3081\u306e\u3055\u307e\u3056\u307e\u306aGem\u304c\u5229\u7528\u53ef\u80fd\u3067\u3059\u304c\u3001\u3053\u308c\u3089\u306eGem\u3092\u4f7f\u308f\u305a\u6a19\u6e96\u6a5f\u80fd\u3060\u3051\u3067\u30c7\u30d0\u30c3\u30b0\u3059\u308b\u65b9\u6cd5\u3092\u77e5\u3063\u3066\u3044\u308b\u3068\u4fbf\u5229\u3067\u3059\u3002<\/p>\n<p>Ruby on Rails\u306e\u958b\u767a\u8005Andres Chacon\u6c0f\u306f\u3001\u305d\u3093\u306aRuby\u958b\u767a\u8005\u5411\u3051\u306eTips\u3092\u7d39\u4ecb\u3059\u308b\u8a18\u4e8b\u300c<a href=\"https:\/\/a-chacon.com\/en\/ruby\/irb\/tip\/2023\/11\/20\/ruby-tip-binding-irb.html\">Interactive debugging without the need to install gems(gems\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\u5fc5\u8981\u306e\u306a\u3044\u30a4\u30f3\u30bf\u30e9\u30af\u30c6\u30a3\u30d6\u306a\u30c7\u30d0\u30c3\u30b0)<\/a>\u300d\u3092\u516c\u958b\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u3053\u306e\u8a18\u4e8b\u306b\u3088\u308b\u3068\u3001Ruby\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u30c7\u30d0\u30c3\u30b0\u3059\u308b\u5834\u5408\u3001\u30d0\u30a4\u30f3\u30c7\u30a3\u30f3\u30b0\u3092\u4f7f\u3046\u3068\u3044\u3046\u9078\u629e\u80a2\u304c\u3042\u308b\u305d\u3046\u3067\u3059\u3002\u30d0\u30a4\u30f3\u30c7\u30a3\u30f3\u30b0\u306f\u3042\u308b\u6642\u70b9\u3067\u306e\u5b9f\u884c\u30b3\u30f3\u30c6\u30ad\u30b9\u30c8\u3092\u30ab\u30d7\u30bb\u30eb\u5316\u3057\u305f\u3082\u306e\u3067\u3001<code>Kernel#binding<\/code>\u3067\u4f5c\u6210\u3057\u3001\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u30e1\u30bd\u30c3\u30c9irb\u3092\u4f7f\u3063\u3066\u30b3\u30f3\u30bd\u30fc\u30eb\u3092\u547c\u3073\u51fa\u3059\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u4f8b\u3048\u3070\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u5185\u5bb9\u306e<code>door.rb<\/code>\u3092\u4f5c\u6210\u3057\u3001<code>ruby door.rb<\/code>\u3067\u5b9f\u884c\u3057\u307e\u3059\u3002<\/p>\n<div class=\"hcb_wrap\">\n<pre class=\"prism line-numbers lang-ruby\" data-lang=\"Ruby\"><code>$&nbsp;ruby&nbsp;door.rb\r\n\r\nFrom:&nbsp;door.rb&nbsp;@&nbsp;line&nbsp;5&nbsp;:\r\n\r\n&nbsp;&nbsp;&nbsp;&nbsp;1:&nbsp;#&nbsp;door.rb\r\n&nbsp;&nbsp;&nbsp;&nbsp;2:&nbsp;class&nbsp;Door\r\n&nbsp;&nbsp;&nbsp;&nbsp;3:&nbsp;&nbsp;&nbsp;def&nbsp;initialize\r\n&nbsp;&nbsp;&nbsp;&nbsp;4:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;@open&nbsp;=&nbsp;false\r\n&nbsp;=&gt;&nbsp;5:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;binding.irb\r\n&nbsp;&nbsp;&nbsp;&nbsp;6:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;puts&nbsp;\"Is&nbsp;the&nbsp;door&nbsp;open:&nbsp;#{@open}\"\r\n&nbsp;&nbsp;&nbsp;&nbsp;7:&nbsp;&nbsp;&nbsp;end\r\n&nbsp;&nbsp;&nbsp;&nbsp;8:&nbsp;end\r\n&nbsp;&nbsp;&nbsp;&nbsp;9:\r\n&nbsp;&nbsp;&nbsp;&nbsp;10:&nbsp;Door.new\r\n\r\nirb(#&lt;Door:0x0000000101d96a00&gt;):001:0&gt;&nbsp;@open\r\n=&gt;&nbsp;false\r\nirb(#&lt;Door:0x0000000101d96a00&gt;):002:0&gt;&nbsp;@open=true\r\n=&gt;&nbsp;true\r\nirb(#&lt;Door:0x0000000101d96a00&gt;):003:0&gt;&nbsp;exit\r\nIs&nbsp;the&nbsp;door&nbsp;open:&nbsp;true<\/code><\/pre>\n<\/div>\n<p>Door\u30af\u30e9\u30b9\u306e\u30a4\u30cb\u30b7\u30e3\u30e9\u30a4\u30b6\u306e\u9014\u4e2d\u306b\u3042\u308b<code>binding.irb<\/code>\u3092\u547c\u3073\u51fa\u3057\u305f\u7b87\u6240\u3067irb\u304c\u8d77\u52d5\u3057\u3001\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u5909\u6570<code>@open<\/code>\u306e\u5024\u3092\u78ba\u8a8d\u3057(\u305d\u306e\u6642\u70b9\u3067\u306ffalse)\u3001\u5024\u3092true\u306b\u5909\u66f4\u3057\u305f\u5f8c\u3001\u5b9f\u884c\u3092\u7d99\u7d9a\u3067\u304d\u308b\u3053\u3068\u304c\u308f\u304b\u308a\u307e\u3059\u3002<\/p>\n<p>\u307e\u305f\u3001debug gem\u304c\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3055\u308c\u3066\u3044\u308c\u3070\u3001IRB\u30bb\u30c3\u30b7\u30e7\u30f3\u3067debug\u3068\u5165\u529b\u3059\u308b\u3060\u3051\u3067\u6709\u52b9\u306b\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u3001\u3088\u308a\u4fbf\u5229\u306a\u30c7\u30d0\u30c3\u30ac\u30fc\u306e\u6a5f\u80fd\u3092\u5229\u7528\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002IRB\u306b\u95a2\u3059\u308b\u60c5\u5831\u306f<a href=\"https:\/\/docs.ruby-lang.org\/en\/master\/IRB.html#module-IRB-label-Usage\">\u3053\u3061\u3089<\/a>\u304b\u3089\u3001debug\u7d71\u5408\u6a5f\u80fd\u306b\u95a2\u3057\u3066\u306f<a href=\"https:\/\/github.com\/ruby\/irb#debugging-with-irb\">\u3053\u3061\u3089<\/a>\u304b\u3089\u78ba\u8a8d\u53ef\u80fd\u3067\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u30d7\u30ed\u30b0\u30e9\u30e0\u306b\u30d0\u30b0\u306f\u3064\u304d\u3082\u306e\u3067\u3001\u30d0\u30b0\u3092\u89e3\u6d88\u3059\u308b\u305f\u3081\u306b\u306f\u30c7\u30d0\u30c3\u30b0\u4f5c\u696d\u304c\u5fc5\u8981\u3068\u306a\u308a\u307e\u3059\u3002 Ruby\u3067\u306f\u30a4\u30f3\u30bf\u30e9\u30af\u30c6\u30a3\u30d6\u306b\u30c7\u30d0\u30c3\u30b0\u3059\u308b\u305f\u3081\u306e\u3055\u307e\u3056\u307e\u306aGem\u304c\u5229\u7528\u53ef\u80fd\u3067\u3059\u304c\u3001\u3053\u308c\u3089\u306eGem\u3092\u4f7f\u308f\u305a\u6a19\u6e96\u6a5f\u80fd\u3060\u3051\u3067\u30c7\u30d0\u30c3\u30b0\u3059\u308b\u65b9\u6cd5\u3092 [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":116676,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"swell_btn_cv_data":"","footnotes":""},"categories":[2047],"tags":[154],"class_list":["post-116667","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tips","tag-ruby"],"_links":{"self":[{"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/posts\/116667","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/comments?post=116667"}],"version-history":[{"count":0,"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/posts\/116667\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/media\/116676"}],"wp:attachment":[{"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/media?parent=116667"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/categories?post=116667"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/tags?post=116667"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}