Created
December 30, 2010 22:40
-
-
Save paulingham/760431 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
module GoggleBox | |
require 'httparty' | |
autoload :TVRage, 'goggle-box/tvrage.rb' | |
autoload :TheTVDB, 'goggle-box/thetvdb.rb' | |
class << self | |
attr_accessor :adapter | |
def adapter | |
@adapter ||= GoggleBox::TVRage | |
end | |
end | |
end | |
### | |
Got the above, and I can do; | |
>> GoggleBox.adapter | |
=> GoggleBox::TVRage | |
and.. | |
>> GoggleBox.adapter = GoggleBox::TheTVDB | |
=> GoggleBox::TheTVDB | |
However, upon change of the adapter, I need to include that adapter module, which includes a Show and Episode class. | |
What's the best way? | |
I can add include @adapter underneath @adapter ||= GoggleBox::TVRage but then I get an adapter set of 'GoggleBox', with Show.search etc include - seems hacky though? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment