From ad5bafb8737c68b8593e318bdfc5a594ab6b6684 Mon Sep 17 00:00:00 2001 From: jbranchaud Date: Tue, 14 Jun 2016 21:19:54 -0500 Subject: [PATCH] Add Require Entire Gemfile In A Pry Session as a ruby til --- README.md | 3 ++- ruby/require-entire-gemfile-in-pry-session.md | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 ruby/require-entire-gemfile-in-pry-session.md diff --git a/README.md b/README.md index a73f516..5f40e31 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ variety of languages and technologies. These are things that don't really warrant a full blog post. These are mostly things I learn by pairing with smart people at [Hashrocket](http://hashrocket.com/). -_432 TILs and counting..._ +_433 TILs and counting..._ --- @@ -329,6 +329,7 @@ _432 TILs and counting..._ - [Rake Only Lists Tasks With Descriptions](ruby/rake-only-lists-tasks-with-descriptions.md) - [Replace The Current Process With An External Command](ruby/replace-the-current-process-with-an-external-command.md) - [Rendering ERB](ruby/rendering-erb.md) +- [Require Entire Gemfile In Pry Session](ruby/require-entire-gemfile-in-pry-session.md) - [Returning With Sequel](ruby/returning-with-sequel.md) - [Running A Single MiniTest Example](ruby/running-a-single-minitest-example.md) - [Safe Navigation Operator](ruby/safe-navigation-operator.md) diff --git a/ruby/require-entire-gemfile-in-pry-session.md b/ruby/require-entire-gemfile-in-pry-session.md new file mode 100644 index 0000000..6c8dec9 --- /dev/null +++ b/ruby/require-entire-gemfile-in-pry-session.md @@ -0,0 +1,18 @@ +# Require Entire Gemfile In Pry Session + +Want to experiment in a pry session with some of the gems in your project's +`Gemfile`? You can quickly require all the gems for your project using +Bundler's `#require` method. + +Just require `bundler` itself and then execute `Bundler.requie`. Everything +will be loaded in. + +```ruby +> require 'bundler' +=> true +> Bundler.require +=> [Gem::Dependency.new("devise", Gem::Requirement.new([">= 0"]), :runtime), + Gem::Dependency.new("rails", Gem::Requirement.new(["= 4.2.5"]), :runtime), + Gem::Dependency.new("pg", Gem::Requirement.new(["~> 0.15"]), :runtime), +... +```