Miscellany
public ruby v1 · immutabledef cleanup(x) s = x.read return s.gsub(/BAD_CHARS/, '')ends = "my string with bad cars"cleanup(s) # Exception, no method error 'read' for class String# ok, let's ducktype sclass String def read return self endendcleanup(s) # whoot works.# if it walks like a duck and talks like a duck, then it must be....