Created
September 25, 2017 14:09
-
-
Save exts/38647cb2407a7b81a3d447ceb464be6d 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
class Test | |
@stored = [] of Proc(Nil) | |
def captured(&block) | |
@stored << block | |
end | |
def example | |
@stored.each do |b| | |
b.call() | |
end | |
end | |
# macro capture(&block) | |
# captured {{block}} | |
# end | |
end | |
# t = Test.new | |
# t.captured do | |
# puts "sup" | |
# end | |
# t.captured do | |
# puts "sup again" | |
# end | |
# t.example | |
# # what I want to do w/ macro | |
# class Derived < Test | |
# capture do | |
# end | |
# end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment