Last active
December 22, 2015 23:19
-
-
Save davidcelis/6545514 to your computer and use it in GitHub Desktop.
Update every instance of a Ruby class
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 Worker | |
class << self | |
attr_accessor :instances | |
def update_instances | |
instances.each do |instance| | |
# Update accordingly | |
end | |
end | |
end | |
def initialize | |
self.class.instances ||= [] | |
self.class.instances << self | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment