S
Stéphane Wirtel
Hi all,
I would like to know if it's possible to overload the [] operator to
use a block with it.
example:
class Test
def []( x )
# to do something here
yield if block_given?
end
end
t = Test.new
t['string'] do
puts 'this is a test'
end
Thanks
I would like to know if it's possible to overload the [] operator to
use a block with it.
example:
class Test
def []( x )
# to do something here
yield if block_given?
end
end
t = Test.new
t['string'] do
puts 'this is a test'
end
Thanks