Created
February 22, 2019 08:12
-
-
Save eprislac/78e3095868e809c73e7b784bdec4522a to your computer and use it in GitHub Desktop.
This file contains hidden or 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
class Integer | |
def fizzbuzziness | |
{ 'Fizz' => (self % 3).zero?, 'Buzz' => (self % 5).zero? } | |
.select { |_key, value| value } | |
.keys | |
.inject('') { |prev, curr| "#{prev}#{curr}" } | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment