Why is irb different from script file?

in irb

def why?
end
=> nil

Object.public_instance_methods.include?(“why?”)
=> true

in test.rb

def why?
end
p Object.private_instance_methods.include?(“why?”) # => true

##################

Help Me^^

##################

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs