From: "Carina C. Zona" Date: 2012-03-07T11:47:45+09:00 Subject: Re: http://ruby-doc.org/docs/keywords/1.9/ : (Object) On Tue, Mar 6, 2012 at 6:34 PM, Kendall Gifford wrote: > On Tue, Mar 6, 2012 at 7:18 PM, Carina C. Zona wrote: >> Object is their class, and the root object in Ruby.  (Well, >> technically BasicObject is now the root object.  But that's if you >> want to bypass the rest of the object heirarchy.)  As shown in the >> core docs, similar notation is standard for all methods. >> > > Hmm, I was under the impression that keywords were distinct from > methods. After all, I can't explicitly specify a receiver when using a > keyword: > > $ irb > 1.9.2-p290 :001 > self.begin > NoMethodError: undefined method `begin' for main:Object >        from (irb):1 >        from /Users/kendall/.rvm/rubies/ruby-1.9.2-p290/bin/irb:16:in `
' > 1.9.2-p290 :002 > self.def hi > NameError: undefined local variable or method `hi' for main:Object >        from (irb):2 >        from /Users/kendall/.rvm/rubies/ruby-1.9.2-p290/bin/irb:16:in `
' > > As such, I'm also confused why a *keyword* is somehow affiliated with > a class. I'd guess/assume it's just how the RDoc engine works and was > used to document keywords (???) as opposed to it actually indicating > that keywords are somehow implemented as methods on Object. I'd love > to know, semantically speaking as well as technically, what the case > is here. > > -- > Kendall Gifford > zettabyte@gmail.com More info here. http://stackoverflow.com/a/9446185/893498 Short version: keywords are an exception to "everything is an object in Ruby". Interesting.