Skip to content

Commit

Permalink
seperated media logic
Browse files Browse the repository at this point in the history
  • Loading branch information
toyhammered committed Jul 6, 2016
1 parent 3e0a5a6 commit a7d7919
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion server/lib/data_import/my_anime_list.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit a7d7919

Please sign in to comment.