self power ruby implementation