Skip to content

Instantly share code, notes, and snippets.

@wjessop
Created May 24, 2010 15:31
Show Gist options
  • Save wjessop/412009 to your computer and use it in GitHub Desktop.
Save wjessop/412009 to your computer and use it in GitHub Desktop.
class IO
alias :old_puts puts
def puts(thing)
if not thing.to_s.match(/\A\*\* Erubis [\d|\.]+\Z/)
return old_puts(thing)
end
end
end
$stdout.puts "foo"
$stdout.puts "** Erubis 2.3.4"
$stdout.puts "bar"
=======================
pleb:~ will$ ruby puts.rb
foo
bar
@caius
Copy link

caius commented May 24, 2010

Or just pipe yer output through grep and do away with patching a core class.

Julius:~ caius$ ruby -e 'puts "foo"' -e 'puts "** Erubis 2.3.4"' -e 'puts "bar"' | \
> egrep -v "^\*\* Erubis [0-9.]+$"
foo
bar

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment