L
Lou Zell
Hi all,
I'm looking for a bit of help. I can't seem to get the block to "pass
through" to the parent class. I figured without an '&' in the parameter
list there would be no conversion to proc but maybe that is not the
case.
class Nstring < String
def gsub!(*args)
super
end
end
This works as I expected:
s = Nstring.new("hi")
s.gsub!(/(hi)/,'\1')
=> "hi"
But this, not so much:
s.gsub!(/(hi)/) {$1}
=> ""
Thanks,
Lou
I'm looking for a bit of help. I can't seem to get the block to "pass
through" to the parent class. I figured without an '&' in the parameter
list there would be no conversion to proc but maybe that is not the
case.
class Nstring < String
def gsub!(*args)
super
end
end
This works as I expected:
s = Nstring.new("hi")
s.gsub!(/(hi)/,'\1')
=> "hi"
But this, not so much:
s.gsub!(/(hi)/) {$1}
=> ""
Thanks,
Lou