Skip to content

Instantly share code, notes, and snippets.

@ClockVapor
Last active August 29, 2015 14:14
Show Gist options
  • Save ClockVapor/2ef73a75c6d0b7fc5f98 to your computer and use it in GitHub Desktop.
Save ClockVapor/2ef73a75c6d0b7fc5f98 to your computer and use it in GitHub Desktop.
class Foo
def initialize(i)
@i = i
ObjectSpace.define_finalizer(self, self.class.clean_up(@i))
end
def self.clean_up(i)
proc {puts "#{i} cleaned!"}
end
end
foos = Array.new(10) {|i| Foo.new(i)}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment