Fix Style/VerboseBlock issues

This commit is contained in:
syeopite
2021-09-24 19:42:43 -07:00
parent 35d15c7c2b
commit e91421253e
15 changed files with 44 additions and 44 deletions

View File

@@ -62,7 +62,7 @@ def get_about_info(ucid, locale)
description_html = HTML.escape(description).gsub("\n", "<br>")
is_family_friendly = initdata["microformat"]["microformatDataRenderer"]["familySafe"].as_bool
allowed_regions = initdata["microformat"]["microformatDataRenderer"]["availableCountries"].as_a.map { |a| a.as_s }
allowed_regions = initdata["microformat"]["microformatDataRenderer"]["availableCountries"].as_a.map(&.as_s)
related_channels = [] of AboutRelatedChannel
else
@@ -84,7 +84,7 @@ def get_about_info(ucid, locale)
description_html = HTML.escape(description).gsub("\n", "<br>")
is_family_friendly = initdata["microformat"]["microformatDataRenderer"]["familySafe"].as_bool
allowed_regions = initdata["microformat"]["microformatDataRenderer"]["availableCountries"].as_a.map { |a| a.as_s }
allowed_regions = initdata["microformat"]["microformatDataRenderer"]["availableCountries"].as_a.map(&.as_s)
related_channels = initdata["contents"]["twoColumnBrowseResultsRenderer"]
.["secondaryContents"]?.try &.["browseSecondaryContentsRenderer"]["contents"][0]?
@@ -149,7 +149,7 @@ def get_about_info(ucid, locale)
end
end
end
tabs = tabs_json.reject { |node| node["tabRenderer"]?.nil? }.map { |node| node["tabRenderer"]["title"].as_s.downcase }
tabs = tabs_json.reject { |node| node["tabRenderer"]?.nil? }.map(&.["tabRenderer"].["title"].as_s.downcase)
end
sub_count = initdata["header"]["c4TabbedHeaderRenderer"]?.try &.["subscriberCountText"]?.try &.["simpleText"]?.try &.as_s?

View File

@@ -101,7 +101,7 @@ struct ChannelVideo
def to_tuple
{% begin %}
{
{{*@type.instance_vars.map { |var| var.name }}}
{{*@type.instance_vars.map(&.name)}}
}
{% end %}
end

View File

@@ -255,11 +255,11 @@ def extract_channel_community_cursor(continuation)
.try { |i| Base64.decode(i) }
.try { |i| IO::Memory.new(i) }
.try { |i| Protodec::Any.parse(i) }
.try { |i| i["80226972:0:embedded"]["3:1:base64"].as_h }
.try(&.["80226972:0:embedded"]["3:1:base64"].as_h)
if object["53:2:embedded"]?.try &.["3:0:embedded"]?
object["53:2:embedded"]["3:0:embedded"]["2:0:string"] = object["53:2:embedded"]["3:0:embedded"]
.try { |i| i["2:0:base64"].as_h }
.try(&.["2:0:base64"].as_h)
.try { |i| Protodec::Any.cast_json(i) }
.try { |i| Protodec::Any.from_json(i) }
.try { |i| Base64.urlsafe_encode(i, padding: false) }