Just for fun...

$ ruby code-nanny.rb
Did you type too fast again? 'initalize' != 'initialize'
Did you type too fast again? 'intialize' != 'initialize'
Did you type too fast again? 'inaltiaez' != 'initialize'
Did you type too fast again? 'initiliaze' != 'initialize'
$ cat code-nanny.rb
module CodeNanny
  def method_added(m)
    if /^in[ital]{2,6}[alize]{2,6}\b/ =~ m.to_s
      if m != :initialize
        warn "Did you type too fast again? '#{m}' != 'initialize'"
      end
    end
  end
end

class Foo
  extend CodeNanny
  def initialize
  end

  def initalize
  end

  def intialize
  end

  def inaltiaez
  end

  def initiliaze
  end
end

Foo.new


Michael Jessop wrote:
> Oh for the love of friggin' PETE!  I spent an hour on this!!!!!!!!!!
> 
> I wish you were here so you could smack me with bat.
> 
> Thanks!
> 
> Mike
> 
> On 2005-08-30 13:28:46 -0700, Jamey Cribbs <cribbsj / oakwood.org> said:
> 
>> Michael Jessop wrote:
>>
>>> I have two simple classes.  One inherits from the other and calls
>>> "super()" in its initialize method.  But the super does not seem to
>>> do what I expect it to do.   I expect the super() to initialize two
>>> variables, but when I call the method to display the initialized
>>> errors, I do not get the value (it things @errmsg is nil).  Here they
>>> are:
>>>
>>> class DBBase
>>>  def initalize
>>>    @failed = false
>>>    @errmsg = 'n/a'
>>>  end
>>
>>
>> The initialize method in class DBBase is spelled incorrectly.
>>
>> Jamey
>>
>> Confidentiality Notice: This email message, including any attachments,
>> is for the sole use of the intended recipient(s) and may contain
>> confidential and/or privileged information. If you are not the
>> intended recipient(s), you are hereby notified that any dissemination,
>> unauthorized review, use, disclosure or distribution of this email and
>> any materials contained in any attachments is prohibited. If you
>> receive this message in error, or are not the intended recipient(s),
>> please immediately notify the sender by email and destroy all copies
>> of the original message, including attachments.
> 
> 
> 


-- 
      vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407