E
Eric Anderson
If I have
**** CODE ****
class A
def method1( argument )
yield( argument )
end
end
class B < A
def method1( argument )
puts argument
super.method1( argument )
end
end
obj = B.new
obj.method1( 'foo' ) { |arg| puts arg + 'bar' }
**** CODE ****
How do I change this to allow class A to get the block. Bascially I
want to override a method to do some pre-processing, but call the
superclass to actually implement the method. The superclass method
uses a block so how do I pass that block to the superclass?
Thanks,
Eric
**** CODE ****
class A
def method1( argument )
yield( argument )
end
end
class B < A
def method1( argument )
puts argument
super.method1( argument )
end
end
obj = B.new
obj.method1( 'foo' ) { |arg| puts arg + 'bar' }
**** CODE ****
How do I change this to allow class A to get the block. Bascially I
want to override a method to do some pre-processing, but call the
superclass to actually implement the method. The superclass method
uses a block so how do I pass that block to the superclass?
Thanks,
Eric