Created
May 14, 2014 14:29
-
-
Save asux/c09fc84883c3175c4ea1 to your computer and use it in GitHub Desktop.
with_visitor
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
def with_visitor | |
@depth = @depth.to_i + 1 | |
@visitor ||= Interface::Millennial::Visitor.new(self) | |
yield @visitor | |
@visitor | |
ensure | |
@depth = @depth - 1 | |
if @visitor and @depth == 0 | |
@visitor.finish if @visitor | |
@visitor = nil | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment