-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Marc Heiler wrote:
> Is there a way to filter what is typed/copy-pasted in/into IRB?
> 
> For example, just for fun and showcasing, to strip any 'a'
> character typed when you are in IRB.
> 
> Or, more importantly and main reason to post this, to replace
> leading whitespace + the first '#' char - so that a ruby
> command, that is normally "protected" as a # comment,
> is run instead.

>> eval STDIN.read.gsub(/^[\s#]*/, '')
puts "yes"
     ## # puts "no, no, no!"
yes
no, no, no!
=> nil


Note that I just copied & pasted some code and then pressed
Control-D to signal that I've finished typing my code.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)

iD8DBQFFDEd2mV9O7RYnKMcRAmvNAJwMtZkFdbME3kfyVQODSntTdqnKdwCeKkyx
GXNvW9CtJhBSM2WnE255Pys=
=YM2c
-----END PGP SIGNATURE-----