日常

ケ・セラ・セラ

Bundler経由でのGemの読込み

こういうことなんですが、require "bundler"; Bundler.setup してから require すればよい。

[1] 2.3.0-p0(main)> require "pico_http_parser"
LoadError: cannot load such file -- pico_http_parser
from /home/284km/.rbenv/versions/2.3.0/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
[2] 2.3.0-p0(main)> Bundler.setup
NameError: uninitialized constant Bundler
from (pry):2:in `__pry__'
[3] 2.3.0-p0(main)> require "bundler"
=> true
[4] 2.3.0-p0(main)> Bundler.setup
=> "GEM\n  remote: https://rubygems.org/\n  specs:\n    pico_http_parser (0.0.4)\n\nPLATFORMS\n  ruby\n\nDEPENDENCIES\n  pico_http_parser\n\nBUNDLED WITH\n   1.11.2\n"
[5] 2.3.0-p0(main)> require "pico_http_parser"
=> true
[6] 2.3.0-p0(main)>