Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
find subclasses
class PullSource
def self.implementations
@implementations ||= {}
end
def self.register(name)
implementations[name] << self
end
end
class SomePullSource < PullSource
register 'Some name'
end
<%= select_whatever PullSource.implementations.keys %>
class PullSource
def self.subclasses
@subclasses ||= []
end
def self.inherited(sub)
subclasses << sub
end
end
class SomePullSource < PullSource
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment