cinchrb / cinch

The IRC Bot Building Framework
http://www.rubydoc.info/gems/cinch
MIT License
1k stars 180 forks source link

Format() fails when NilObject is passed in. (issue #100) #101

Closed mseymour closed 11 years ago

mseymour commented 11 years ago

I have tested the conditional code, and it appears to work correctly. When a nil is passed in (Or False), it will transform it into a string with #to_s and dup it, otherwise it will just duplicate the object.

dominikh commented 11 years ago

Not sure it's the responsibility of Format() to deal with objects other than strings. Maybe you should #to_s the object you pass to Format() instead?

dominikh commented 11 years ago

The documentation explicitly says that the parameter has to be a String, not that it implements #to_s, and I think I'll go with that.

Besides, your patch only adds a special case for nil, and I don't see why we should treat it special.