LoginSignup
0
0

More than 1 year has passed since last update.

gemとはなにか?

Last updated at Posted at 2021-12-12

gemとは

1つのgem形式のファイルにパッケージングされたRubyの外部ライブラリのこと。
よく使われるRailsもgemの1つ。Rails自体が多くのgemで構成されている。

Rubyのライブラリの種類
  • 標準ライブラリ
    • 組み込みライブラリ:Ruby本体に組み込まれるライブラリ((Array,Stringなど)
    • 組み込みでないライブラリ:JSON,CSVなど
  • 外部ライブラリ:device,rails,rspecなど

どうやってインストールしているのか?

Rubyインストール時に標準ライブラリとしてインストールされるRubyGemsにより$ gem install [gem名]が使え、gemのインストールが可能になっている。

どこにインストールされるのか?

以下のコマンドで保管場所が表示される。

ターミナル
$ gem environment gemdir
/usr/local/bundle     #実行結果(筆者docker環境)

/usr/local/bundle $ ls
bin  build_info  cache  doc  extensions  gems  specifications

/usr/local/bundle $ cat gems
ctioncable-6.1.4.1              capybara-3.35.3          parser-3.0.2.0              rspec-support-3.10.2
actionmailbox-6.1.4.1            childprocess-3.0.0       pg-1.2.3                    rubocop-1.22.3
actionmailer-6.1.4.1             coderay-1.1.3                        などなど

最後に

今まで詳しく知ろうとせず「便利だな〜」くらいにしか思っていなかったgem。ちゃんと調べることで、いつも近くで支えてくれていたことに気づき、感謝の気持ちが溢れました。
勉強大切。。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0