Tobias Reif <tobiasreif / pinkjuice.com> writes:

> >   irbsh(main):001:0> e = Exception.new("hello")
> >   #<Exception: hello>
> >   irbsh(main):002:0> "123".sub(/./, e)
> >   "hello23"
> 
> 
> Could you be so kind and explain the above to me?

The second parameter to .sub is any object that responds to to_str. It
need not be a String. This is what I mean when I say that classes
aren't types, and that Ruby method parameters are typed by protocols,
rather than class names.


Dave