sample code for design pattern write by ruby