# # Copyright Michael Orlitzky # # http://michael.orlitzky.com/ # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # http://www.fsf.org/licensing/licenses/gpl.html # # This class keeps track of all its subclasses # We use this to loop through every "website" in an # attempt to determine to which site a URL belongs. class Website def self.inherited(subclass) if superclass.respond_to? :inherited superclass.inherited(subclass) end # Every time we're subclassed, add the new # subclass to our list of subclasses. @subclasses ||= [] @subclasses << subclass end def self.subclasses @subclasses end # This should be overridden in any class that wants # to claim ownership of a URL. def self.owns_url?(url) return false end # Same here. We want to default to nil unless overridden. def get_video_url(url) return nil end end