Created
March 6, 2020 16:48
-
-
Save havenwood/e09b8a980ba3378b03a9c2a7b4ec8170 to your computer and use it in GitHub Desktop.
My solution to phaul's kata mentioned in #ruby IRC: https://www.codewars.com/kata/59b7b7f0623654c2ce000021/ruby
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
module IterateString | |
refine String do | |
def iterate(count, &block) | |
Enumerator.produce(self, &block).first(count) | |
end | |
end | |
end | |
using IterateString | |
'str'.iterate(3) {|s| s * 2 } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment