I'm trying to debug a simple ruby console script and am getting a load error when trying to require pry:
- I'm using rbenv to management environment.
- I'm using Ruby version: 2.3.1.
- Trying to use Pry '~> 0.10.4'
/Users/gangelo/.rbenv/versions/2.3.1/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- pry (LoadError)
I've used Pry and Byebug in the past in rails applications and never had any issues like this. Searching for a solution, I've found that most issues are related to either not including Pry in the Gemfile or not including the Pry gem in the correct environment in the Gem file; this isn't the case with me, what am I doing wrong?
# /Gemfile
group :development, :test do
gem 'pry', '~> 0.10.4'
end
And in my script:
# /calculator/rpn_calculator_service.rb
module RealPage
module Calculator
# Provides Reverse Polish Notation computation services.
class RPNCalculatorService < CalculatorService
include Helpers::Arrays
def initialize
super RPNInputParser.new
end
def compute(input)
# Load error here :(
require 'pry'; binding.pry
# Code removed for brevity...
end
# Code removed for brevity...
end
end
end
I was receiving a similar error trying to run my gem cars:
I deducted that maybe my gem was not installed so I just ran:
And then executed my gem as usual