completed p7 in ruby