Created
December 19, 2018 08:54
-
-
Save knu/4fd422f5ebe6fbbeea8b1d4adcc1ec12 to your computer and use it in GitHub Desktop.
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 Foo | |
refine Hash do | |
def each_smtn(&block) | |
return to_enum(__method__) unless block | |
block.call(1) | |
block.call(2) | |
end | |
end | |
end | |
using Foo | |
Hash.new.each_smtn.each { |x| p x } | |
#=> undefined method `each_smtn' for {}:Hash (NoMethodError) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can do this instead: