globals/argf_gets.rb

tests/_examples/globals/argf_gets.rb in the metorex repository.

def ARGF.gets
  "stubbed line"
end

puts gets
puts ARGF.gets
puts Kernel.private_instance_methods.include?(:gets)
puts ARGF.class

Output:

stubbed line
stubbed line
true
ARGF.class