How do you conditionally execute something when overwriting super, while still returning the result of super? I am sure there is a cleaner way of writing this in Ruby
def my_method
result = super
if result.success?
my_other_method1
my_other_method2
if @my_field
@x = @y
end
end
result
end
I believe something can be done with block, but don’t really understand them yet. Any pointers would be greatly appreciated.
If you’re using ruby 1.9, you could use the
Object#tapmethod to clean that up a bit.