On Wed, Mar 07, 2007 at 07:54:15PM +0900, 7stud 7stud wrote:
> If I run the following code, I don't get any errors:
> 
> class MegaGreeter
>         attr_accessor :names
> 
>         #constructor
>         def initialize(names = "world")
>                 @names = names
>         end
> 
>         #functions:
>         def say_hi
>                 if @names.nil?
>                         puts "..."
>                 elseif @names.respond_to?("each")
>                         @names.each do |name|
>                                 puts "Hello #{name}!"
>                         end
>                 else
>                         puts "Hello #{@names}!"
>                 end
>         end
> end
> if __FILE__ == $0
>         mg = MegaGreeter.new(["Sally", "Jane", "Bob"])
>         mg.say_hi
> end

That's because you're not exercising the section under @names.nil?

Try: mg = MegaGreeter.new(nil)