From a7d79193fe951e3c83df202d73952ce3d276de47 Mon Sep 17 00:00:00 2001 From: toyhammered Date: Tue, 5 Jul 2016 22:01:20 -0700 Subject: [PATCH] seperated media logic --- server/lib/data_import/my_anime_list.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/server/lib/data_import/my_anime_list.rb b/server/lib/data_import/my_anime_list.rb index 559118258..4f2971cba 100644 --- a/server/lib/data_import/my_anime_list.rb +++ b/server/lib/data_import/my_anime_list.rb @@ -13,7 +13,9 @@ def initialize(opts = {}) end def get_media(external_id) # anime/1234 or manga/1234 - media = Mapping.lookup('myanimelist', external_id) || external_id.split('/').first.classify.constantize.new # should return Anime.new or Manga.new + media = Mapping.lookup('myanimelist', external_id) + klass = external_id.split('/').first.classify.constantize # should return Anime or Manga + media ||= klass.new # picks the class get(external_id) do |response| details = Extractor::Media.new(response)