extracted Ruby code into Gem