about summary refs log tree commit diff
diff options
context:
space:
mode:
authorNick Schonning <nschonni@gmail.com>2023-02-08 04:36:23 -0500
committerGitHub <noreply@github.com>2023-02-08 10:36:23 +0100
commit0d1f192c54ab65a4a1c938553e5d87be65a966e8 (patch)
tree08d2241a883349ae36b3613029c88acd6b7e4434
parent26ac2447b4efc4689295188c5d1cd3d444f28b15 (diff)
Apply Rubocop Performance/BlockGivenWithExplicitBlock (#23441)
* Apply Rubocop Performance/BlockGivenWithExplicitBlock

* Unprefix used block parameter
-rw-r--r--app/helpers/application_helper.rb4
-rw-r--r--app/helpers/jsonld_helper.rb4
-rw-r--r--app/lib/extractor.rb2
-rw-r--r--app/models/trends/history.rb2
4 files changed, 6 insertions, 6 deletions
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 4c20f1e14..b2687eddd 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -67,7 +67,7 @@ module ApplicationHelper
   def link_to_login(name = nil, html_options = nil, &block)
     target = new_user_session_path
 
-    html_options = name if block_given?
+    html_options = name if block
 
     if omniauth_only? && Devise.mappings[:user].omniauthable? && User.omniauth_providers.size == 1
       target = omniauth_authorize_path(:user, User.omniauth_providers[0])
@@ -75,7 +75,7 @@ module ApplicationHelper
       html_options[:method] = :post
     end
 
-    if block_given?
+    if block
       link_to(target, html_options, &block)
     else
       link_to(name, target, html_options)
diff --git a/app/helpers/jsonld_helper.rb b/app/helpers/jsonld_helper.rb
index 102e4b132..e5787fd47 100644
--- a/app/helpers/jsonld_helper.rb
+++ b/app/helpers/jsonld_helper.rb
@@ -213,7 +213,7 @@ module JsonLdHelper
     end
   end
 
-  def load_jsonld_context(url, _options = {}, &_block)
+  def load_jsonld_context(url, _options = {}, &block)
     json = Rails.cache.fetch("jsonld:context:#{url}", expires_in: 30.days, raw: true) do
       request = Request.new(:get, url)
       request.add_headers('Accept' => 'application/ld+json')
@@ -226,6 +226,6 @@ module JsonLdHelper
 
     doc = JSON::LD::API::RemoteDocument.new(json, documentUrl: url)
 
-    block_given? ? yield(doc) : doc
+    block ? yield(doc) : doc
   end
 end
diff --git a/app/lib/extractor.rb b/app/lib/extractor.rb
index aea60dae5..ead4cdddd 100644
--- a/app/lib/extractor.rb
+++ b/app/lib/extractor.rb
@@ -18,7 +18,7 @@ module Extractor
     return [] if entities.empty?
 
     entities = remove_overlapping_entities(entities)
-    entities.each(&block) if block_given?
+    entities.each(&block) if block
     entities
   end
 
diff --git a/app/models/trends/history.rb b/app/models/trends/history.rb
index 03d62103f..83532e7bc 100644
--- a/app/models/trends/history.rb
+++ b/app/models/trends/history.rb
@@ -87,7 +87,7 @@ class Trends::History
   end
 
   def each(&block)
-    if block_given?
+    if block
       (0...7).map { |i| yield(get(i.days.ago)) }
     else
       to_enum(:each)