Skip to content

Commit

Permalink
Oops
Browse files Browse the repository at this point in the history
  • Loading branch information
kangkyu committed Jun 24, 2019
1 parent d70165c commit 2dfb42c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/yt/models/url.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,12 @@ def id

# @return [<Yt::Channel>] the resource associated with the URL
def resource(options = {})
@resource ||= [Video, Channel, Playlist].detect {|r| r.new(url: @text)}
@resource ||= case kind
when :channel then Yt::Channel
when :video then Yt::Video
when :playlist then Yt::Playlist
else raise Yt::Errors::NoItems
end.new options.merge(id: id)
end
end
end
Expand Down

0 comments on commit 2dfb42c

Please sign in to comment.