3 ms·
I find a better way of doing this is to use a module. x = Object.new x.extend Module.new { def foo; puts 'bar'; end } x.foo # >> bar
by caiusdurling 14y ago
I find a better way of doing this is to use a module.
x = Object.new
x.extend Module.new { def foo; puts 'bar'; end }
x.foo
# >> bar