åå 㧠WSL ã« Ruby 3.3 ãå ¥ã£ãã®ã§æ¬¡ã¯ irb ã®è¨å®ããã¾ãã
ææ°ã® irb ã§ã¯åè£å®ã®è¿½å ãè£å®ãã¤ã¢ãã°ã®è²å¤æ´APIããããã°ã«ä¾¿å©ãªæ©è½ããã®ä»ä¾¿å©ãªæ©è½è¿½å ãªã©ãå ¥ãã対話çãªãããã¿ã¤ãã³ã°ããããã°ãå¦ç¿ãå®é¨ã®ä½æ¥å¹çã大ããåä¸ãã¦ãã¾ããã¾ãåæ å ±ãå©ç¨ãããã精度ã®é«ãè£å®ã¢ã«ã´ãªãºã ã使ããããã«ãªã£ã¦ãã¾ããç®æ¨ã¯èªåã®æ¸ãã¦ããã©ã¤ãã©ãªå ã® sig/ ã«è¨è¿°ããã¡ã½ãããè£å®ã§ããããã«ãããã¨ã§ãã
irb ã®ã»ããã¢ãã
bash(ã·ã§ã«)ã«ä»¥ä¸ãè²¼ãä»ãã¦å®è¡ãã¾ãã
# gem ã®ã¤ã³ã¹ãã¼ã« gem install repl_type_completor # .irbrc ã«è¨å®è¿½å echo 'IRB.conf[:COMPLETOR] = :type' >> ~/.irbrc # irb èµ·åã irb
irb ãèµ·åããã irb_info ã§è¨å®ã確èªãã¾ããCompletion ã« ReplTypeCompletor
ã使ããã¦ãããæåã§ãã
irb(main):001> irb_info Ruby version: 3.3.1 IRB version: irb 1.13.1 (2024-05-05) InputMethod: RelineInputMethod with Reline 0.5.8 Completion: Autocomplete, ReplTypeCompletor: 0.1.6, Prism: 0.29.0, RBS: 3.5.0.pre.2 .irbrc paths: /home/ongaeshi/.irbrc RUBY_PLATFORM: x86_64-linux LANG env: C.UTF-8 East Asian Ambiguous Width: 1 => nil
åºæ¬çãªä½¿ãæ¹
ããã¹ããå ¥åããã¨èªåã§è£å®åè£ã表示ããã¾ããè£å®åè£ã表示ããã¦ããã¨ãã¯ä»¥ä¸ã®ããããã¼ã使ãã¾ãã
æä½ | ããããã¼ |
---|---|
次ã®è£å®åè£ã«ç§»å | TAB |
1ã¤åã®è£å®åè£ã«ç§»å | Shift+TAB |
è£å®å¯¾è±¡ã®ããã¥ã¡ã³ãã表示 | Alt+D |
ã¾ãè£å®ä¸ã«é¢ãããããã¹ãå ¥åä¸ã¯ä»¥ä¸ã®ããããã¼ã使ãã¾ãã
æä½ | ããããã¼ |
---|---|
å ¥åä¸ã®ããã¹ãããã¹ã¦ã¯ãªã¢ | Ctrl+U |
ç´åã®ãããã¾ã§ããã¹ããã¯ãªã¢ | Alt+Backspace |
éçºä¸ã®ã©ã¤ãã©ãªã sig ãèªã¿è¾¼ãã ç¶æ 㧠irb ãèµ·åããã
bundler ã« repl_type_completor 㨠irb ã追å ãã¾ãã
⻠注: 2024-06-16 ç¾å¨ãirb ã«ã¯ repl_type_completor ã®ä¾åãå«ã¾ãã¦ããªãã®ã§æåã§ã¤ã³ã¹ãã¼ã«ããå¿ è¦ãããã¾ãã
$ cd /path/to/project $ bundle add repl_type_completor irb --group development
bundle exec çµç±ã§ irb ãèµ·åããã¨ã©ã¤ãã©ãªã require ã§ããããã«ãªãã¾ãã
$ bundle exec irb
ããã§ã©ã¤ãã©ãªã« sig ãæ¸ãã¦ããã°è£å®ãå¹ãããã«ãªãã¾ãã