All pastes #928367 Raw Edit

Miscellany

public ruby v1 · immutable
·published 2008-03-05 00:04 UTC
rendered paste body
def 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....