Skip to content

Instantly share code, notes, and snippets.

@darrend
Last active December 24, 2015 16:58
Show Gist options
  • Save darrend/6831636 to your computer and use it in GitHub Desktop.
Save darrend/6831636 to your computer and use it in GitHub Desktop.
Is there a tighter way to do this?
num_fragments = 0
counter = lambda { num_fragments += 1 }
counter = Class.new do
def initialize
@counter = 0
end
def next
@counter += 1
end
end.new
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment