Skip to content

Instantly share code, notes, and snippets.

@exts
Created September 25, 2017 14:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save exts/38647cb2407a7b81a3d447ceb464be6d to your computer and use it in GitHub Desktop.
Save exts/38647cb2407a7b81a3d447ceb464be6d to your computer and use it in GitHub Desktop.
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