I want to reload a file in irb. The file, prime.rb
, contains the following code:
def is_prime? num
(2..num-1).each do |div_by|
if num % div_by == 0
return false
end
end
true
end
I can use require_relative
to require the file:
irb(main):001> require_relative 'prime'
=> true
irb(main):002> is_prime? 10
=> false
irb(main):003> is_prime? 11
=> true
If I make a change to prime.rb
, how can I reload the file? I have tried:
irb(main):004> require_relative 'prime'
=> false
The same behavior occurs in pry.