Noob question:
Consider the following C# code:
public IEnumerable<xpto> CalculatedList {
get { foreach(var item in privateList.OfType<xpto>()) yield return item; }
}
What would be the correspondent code in Ruby? The thing is that I want the return object of a class method to behave just like an Enumerable, so I can call include?, sort_by, etc. on it.
By the way, I know I can make the method return a list, but that wouldn't be (a) lazy, since the list would need to be calculated first, (b) looking for an ideomatic solution :-)