Last active
August 29, 2015 14:08
-
-
Save wulab/98e83808a9b2960a9a1f to your computer and use it in GitHub Desktop.
My solution to https://github.com/oozou/challenges/pull/1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'prime' | |
class Raindrops | |
def self.convert(number) | |
factors = number.prime_division.to_h.keys & [3, 5, 7] | |
return number.to_s if factors.empty? | |
factors.join.tr('357', 'iao').gsub(/(\w)/, 'Pl\1ng') | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment