Alternative Ways to Define MethodsRuby’s Normal Method Definition ProcessDefining Class Methods Using an Object PrefixDefining Class Methods Using a New Lexical ScopeDefining Methods Using Singleton ClassesDefining Methods Using Singleton Classes in a Lexical ScopeCreating RefinementsUsing RefinementsExperiment 9-1: Who Am I? How self Changes with Lexical Scopeself in the Top Scopeself in a Class Scopeself in a Metaclass Scopeself Inside a Class MethodMetaprogramming and Closures: eval, instance_eval, and bindingCode That Writes CodeCalling eval with bindingAn instance_eval ExampleAnother Important Part of Ruby Closuresinstance_eval Changes self to the Receiverinstance_eval Creates a Singleton Class for a New Lexical ScopeExperiment 9-2: Using a Closure to Define a MethodUsing define_methodMethods Acting as ClosuresSummary