Skip to content

Commit

Permalink
Remove NilClass#[] monkeypatching.
Browse files Browse the repository at this point in the history
  • Loading branch information
stefansundin committed Apr 6, 2021
1 parent 2821c8b commit ee8fbfc
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 5 deletions.
2 changes: 1 addition & 1 deletion app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@
next "Error: Could not find the user. Please try with a video url instead." if response.code == 404
raise(App::GoogleError, response) if !response.success?
doc = Nokogiri::HTML(response.body)
doc.at("meta[itemprop='channelId']")["content"] || "Error: Could not find the user. Please try with a video url instead."
doc.at("meta[itemprop='channelId']")&.[]("content") || "Error: Could not find the user. Please try with a video url instead."
end
elsif video_id
channel_id, _ = App::Cache.cache("youtube.video", video_id, 60*60, 60) do
Expand Down
4 changes: 0 additions & 4 deletions config/initializers/05-nil.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,4 @@ def linkify_and_embed(request=nil, embed_only="")
def embed_html(request=nil)
nil
end

def [](key)
false
end
end

0 comments on commit ee8fbfc

Please sign in to comment.