DriversManual: Metaprogramming Ruby Chapter 2 Part 2


The Object Model


Contents


Namespaces

  module Bookworm
    class Text
      ...

Loading and Requiring

Ruby Method

Method look up

The Kernel

module Kernel
  def ap( object, options = {} )
    ...
  end
end

Method execution

private methods

Refinements


Quiz Questions

Q: How would you access module Bookworm class Text ...?
A: Bookworm::Text
Q: How does ruby call a method?
A: 1) Method Lookup 2) execution
Q: How do you have module methods checked before class ones?
A: `prepend [module name] instead of `include`
Q: How do you have 'language keyword' type features?
A: add methods to `Kernel`
Q: What keyword references method receivers?
A: self
Q: What is an explicit method call?
A: calls with `self.` on it
Q: Can `private` methods have explicit method calls?
A: no
Q: What is the top level object you start in when you use irb?
A: the `main` object