Topic: [SWIG/Ruby] How to make an iterated class.

There is a C ++ classes which have methods begin () and end () which presence is a sufficient condition for object iteration procedure in With ++ and how to make also that this object it was iterated by means SWIG in  language (Ruby for example)? For some reason it seems to me that there should be any simple and obvious decision as the case obvious enough and on idea should be claimed, but meanwhile can find nothing. In most SWIG there is an iteration procedure support std containers, but there all is difficult and separate implementation for each container is written. Who can already faced, prompt  where at least to dig? Well it would be very grateful, as it brakes one task, let and minor, but very interesting.