Last active
May 25, 2023 05:19
-
-
Save pdobb/370ab06a744af58360a2 to your computer and use it in GitHub Desktop.
Use AwesomePrint in Rails Console without adding to Gemfile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AwesomePrint.defaults = { | |
:indent => -2, | |
:color => { | |
:string => :greenish, | |
:date => :yellowish, | |
:time => :yellowish, | |
:nilclass => :cyanish | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Determine the load path for your system by running `gem which awesome_print`; | |
# remove `awesome_print.rb` from the end of the output. | |
$LOAD_PATH << '/Users/pdobb/.gem/ruby/1.9.3/gems/awesome_print-1.6.1/lib/' | |
require "awesome_print" |
YES! Thank you! 🍻
I couldn't figure out how to get the load path into .irbrc
until you showed me gem which [gem_name]
@fakefarm No problem. Although I've since learned that you can just do gem "awesome_print"
to load the gem. For example:
begin
gem 'awesome_print'
require 'awesome_print'
AwesomePrint.pry!
rescue Gem::LoadError
puts 'The "awesome_print" gem is not installed. Skipping AwesomePrint.pry!'
end
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Instructions:
gem install awesome_print
ap
.