---
title: "ruby | 今日の学び | OOZOU"
description: "OOZOUチームによる短く実践的なrubyのメモ。"
canonical: https://oozou.com/ja/til-topics/ruby
locale: ja
---

# ruby | 今日の学び

> OOZOUチームによる短く実践的なrubyのメモ。

- [先頭ドット記法を使った複数行の Ruby ブロックを Pry に貼り付けられるようにする](https://oozou.com/ja/til/allow-pasting-multiline-ruby-blocks-in-pry-when-using-leading-dot-notation-116) ([markdown](https://oozou.com/ja/til/allow-pasting-multiline-ruby-blocks-in-pry-when-using-leading-dot-notation-116.md)) (2021-04-30): 最近は先頭ドット記法をよく使います。例：
- [式展開なしの Heredoc](https://oozou.com/ja/til/heredoc-without-interpolation-74) ([markdown](https://oozou.com/ja/til/heredoc-without-interpolation-74.md)) (2020-10-14): Ruby の Heredoc を式展開（'#{....}'）なしで使いたいことがあります。キーワードの前後にシングルダッシュを追加することで実現できます：
- [Ruby で中間階層のハッシュテーブルを自動生成する](https://oozou.com/ja/til/automagical-intermediate-level-hashtables-in-ruby-62) ([markdown](https://oozou.com/ja/til/automagical-intermediate-level-hashtables-in-ruby-62.md)) (2020-10-13): すべての中間階層のハッシュテーブルが自動的に作成されます
- [rbenv で単一コマンドだけ Ruby のバージョンを変更する](https://oozou.com/ja/til/change-ruby-version-for-single-command-with-rbenv-68) ([markdown](https://oozou.com/ja/til/change-ruby-version-for-single-command-with-rbenv-68.md)) (2020-10-13): rbenv local で Ruby のバージョンを一時的に切り替えられます
- [VS Code の Go to definition を Cmd+Click に変更する](https://oozou.com/ja/til/change-vs-code-go-to-definition-to-cmd-click-59) ([markdown](https://oozou.com/ja/til/change-vs-code-go-to-definition-to-cmd-click-59.md)) (2020-10-13): ユーザー設定の JSON ファイルを開いて、このオプションを使うだけです：
- [Bundler のパフォーマンスを改善する](https://oozou.com/ja/til/improve-bundler-performance-56) ([markdown](https://oozou.com/ja/til/improve-bundler-performance-56.md)) (2020-10-13): bundler のタスクを jobs で並列実行して、bundler のパフォーマンスをレベルアップしましょう：
- [optional なリレーション + RSpec w/shoulda-matchers](https://oozou.com/ja/til/optional-relation-rspec-w-shoulda-matchers-41) ([markdown](https://oozou.com/ja/til/optional-relation-rspec-w-shoulda-matchers-41.md)) (2020-10-13): User 1 - 0..1 Laptop
- [ruby 2.6 に同梱された bundler を削除する](https://oozou.com/ja/til/remove-ruby-2-6-bundled-bundler-39) ([markdown](https://oozou.com/ja/til/remove-ruby-2-6-bundled-bundler-39.md)) (2020-10-13): bundler v2 をインストールした状態で ruby 2.6+ を使って rails 6 アプリを生成すると、使えない binstub が作られます。You must use Bundler 2 or greater with this lockfile. というエラーが表示される場合は、削除する…
- [現在のブランチに対してrubocopを実行する](https://oozou.com/ja/til/run-rubocop-against-your-current-branch-21) ([markdown](https://oozou.com/ja/til/run-rubocop-against-your-current-branch-21.md)) (2020-10-13): 現在のブランチに対してrubocopを実行する
- [コミット前にrubocopを実行する](https://oozou.com/ja/til/run-rubocop-before-commit-8) ([markdown](https://oozou.com/ja/til/run-rubocop-before-commit-8.md)) (2020-10-13): GitフックはGitリポジトリでのタスク自動化やコーディング規約の徹底に非常に強力です。よくあるユースケースのひとつが、コミットを許可する前に自動テストやコード解析ツールを実行することです…
- [rspecの警告を抑制する](https://oozou.com/ja/til/suppress-rspec-warnings-33) ([markdown](https://oozou.com/ja/til/suppress-rspec-warnings-33.md)) (2020-10-13): $ RUBYOPT=W0 bundle exec rspec spec/ ...
- [FactoryBotはActiveRecord以外のモデルにも使える](https://oozou.com/ja/til/you-can-use-factorybot-for-non-activerecord-models-45) ([markdown](https://oozou.com/ja/til/you-can-use-factorybot-for-non-activerecord-models-45.md)) (2020-10-13): FactoryBotの initialize\with* メソッドを使うと、オブジェクトを好きな方法で初期化でき、任意のオブジェクトを自在にファクトリー化できます

All notes: [今日の学び](https://oozou.com/ja/til) ([markdown](https://oozou.com/ja/til.md)).

---

Contact OOZOU: hello@oozou.com · +66 2544 0000 · https://oozou.com/ja/contact

More for AI agents: https://oozou.com/llms.txt · every page has a markdown twin at its URL plus ".md"
