From: "Vít Ondruch" Date: 2009-10-13T01:20:47+09:00 Subject: Subclassing in module from top module? Hello everybody, I would like to have locally monkeypatched Hash in my module. I would expect that following example will work, however it doesn't. How to do it correctly? irb(main):016:0> module Foo irb(main):017:1> class Hash << ::Hash irb(main):018:2> def bar irb(main):019:3> puts 'bar' irb(main):020:3> end irb(main):021:2> end irb(main):022:1> end SyntaxError: (irb):17: syntax error, unexpected tLSHFT, expecting '<' or ';' or '\n' class Hash << ::Hash ^ from c:/Ruby/bin/irb:12:in `
' Cheers, Vit -- Posted via http://www.ruby-forum.com/.