From 58f4dd82435a9cc21bfed2efa3707425dd4536eb Mon Sep 17 00:00:00 2001 From: Geremia Taglialatela Date: Fri, 20 Sep 2024 08:59:44 +0200 Subject: [PATCH] Prefer `require_relative` for internal requires `require_relative` is preferred over `require` for files within the same project because it uses paths relative to the current file, making code more portable and less dependent on the load path. This change updates internal requires to use `require_relative` for consistency, performance, and improved portability. Ref: - rubocop/rubocop#8748 --- lib/hawk.rb | 8 ++++---- lib/hawk/http.rb | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/hawk.rb b/lib/hawk.rb index 74911cd..65ac8b8 100644 --- a/lib/hawk.rb +++ b/lib/hawk.rb @@ -4,8 +4,8 @@ require 'active_support/core_ext/hash/deep_merge' require 'active_support/core_ext/object/blank' -require 'hawk/version' +require_relative 'hawk/version' -require 'hawk/error' -require 'hawk/http' -require 'hawk/model' +require_relative 'hawk/error' +require_relative 'hawk/http' +require_relative 'hawk/model' diff --git a/lib/hawk/http.rb b/lib/hawk/http.rb index 2143a67..e40bff5 100644 --- a/lib/hawk/http.rb +++ b/lib/hawk/http.rb @@ -5,8 +5,8 @@ module Hawk require 'typhoeus' require 'multi_json' - require 'hawk/http/caching' - require 'hawk/http/instrumentation' + require_relative 'http/caching' + require_relative 'http/instrumentation' ## # Represent an HTTP connector, to be linked to a {Model}.