Kernel is Ruby’s built-in module for many fundamental methods shared by ordinary objects. Object mixes in Kernel, so instances of Object and its descendants can use Kernel’s instance methods. section 4.0 section 4.2.1
A bareword call
puts "Hello" The call has no explicit receiver because puts is a private instance method of Kernel. Object’s inclusion of Kernel makes this style available at the top level and to ordinary objects. section 5.4.2
Kernel supplies methods used in both short scripts and larger programs:
- puts and print for output. section 5.4.2
- require and load for bringing code into a program. section 5.4.2
- raise for raising exceptions, along with methods for reading, writing, running system commands, and exiting programs. section 5.4.2
- Private methods defined at the top level also become Kernel methods, making them available as bareword calls. section 5.5
$ ruby -e 'p Kernel.private_instance_methods.sort'
Inspect Kernel’s private instance methods with Ruby’s private_instance_methods method and sort the resulting names. section 5.4.2
