good example on how to use a yield i a class method