Skip to content

Instantly share code, notes, and snippets.

@jeremywrowe
Created October 6, 2012 01:51
Show Gist options
  • Save jeremywrowe/3843438 to your computer and use it in GitHub Desktop.
Save jeremywrowe/3843438 to your computer and use it in GitHub Desktop.
Can this be done better?
module Frank
class Sinatra
def self.inherited(subclass)
(@@subclasses ||= []) << subclass
@@subclasses.uniq!
end
def self.for_namespace(filter)
@@subclasses.select{|c| c.to_s.include? filter.to_s }
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment