2

I've been using Pry with Rails for a while via the Pry-Rails Gem.

I want to add Hirb and Awesome Print to Pry, so I've added initialisation code to my ~/.pryrc file as described here and here:

# ~/.pryrc

require 'rubygems'

# Hirb for Tables

begin
  require 'hirb'

  Hirb.enable
  old_print = Pry.config.print
  Pry.config.print = proc do |output, value|
    Hirb::View.view_or_page_output(value) || old_print.call(output, value)
  end
rescue LoadError => err
  puts "no hirb :("
end

# Awesome Print

begin
  require 'awesome_print'
  Pry.config.print = proc { |output, value| output.puts value.ai }
rescue LoadError => err
  puts "no awesome_print :("
end

However, when I run $rails c Pry can't find either Hirb or Awesome print.

Why is this?

phoet
  • 18,688
  • 4
  • 46
  • 74
Undistraction
  • 42,754
  • 56
  • 195
  • 331

0 Answers0