On Thu, Jun 26, 2008 at 3:04 AM, Joel VanderWerf
<vjoel / path.berkeley.edu> wrote:
> Tristin Davis wrote:
>>
>>  def add_notifier(notifier=nil, &block)
>>     if block_given?
>>        @notifiers << block
>>     else
>>        @notifiers << notifier
>>     end
>>  end
>
>  def add_notifier(notifier=nil, &block)
>     @notifiers << (block || notifier)
>  end

I think you could end up adding some nils with
this solution and the previous one, if I call:

Heartbeat.new.add_notifier

without any argument or block. Maybe you will
want to check it in the add_notifier method, or
at least handle it in the thump method, to avoid
calling the call method on nil. Maybe something like:

def add_notifier(notifier=nil, &block)
     raise "Both nil" unless (notifier || block)
     @notifiers << (block || notifier)
end

Jesus.