From a0f55ee85a78267566cd9cc28e09ae8d465bb294 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Rodr=C3=ADguez?= Date: Wed, 6 Oct 2021 11:51:33 +0200 Subject: Prefer `require_relative` for internal requires --- lib/psych.rb | 34 +++++++++++++++++----------------- lib/psych/class_loader.rb | 4 ++-- lib/psych/core_ext.rb | 2 +- lib/psych/handlers/document_stream.rb | 2 +- lib/psych/handlers/recorder.rb | 2 +- lib/psych/json/stream.rb | 4 ++-- lib/psych/json/tree_builder.rb | 2 +- lib/psych/nodes.rb | 14 +++++++------- lib/psych/nodes/node.rb | 4 ++-- lib/psych/syntax_error.rb | 2 +- lib/psych/tree_builder.rb | 2 +- lib/psych/visitors.rb | 12 ++++++------ lib/psych/visitors/json_tree.rb | 2 +- lib/psych/visitors/to_ruby.rb | 6 +++--- lib/psych/visitors/yaml_tree.rb | 6 +++--- 15 files changed, 49 insertions(+), 49 deletions(-) (limited to 'lib') diff --git a/lib/psych.rb b/lib/psych.rb index ecf3b39..3830787 100644 --- a/lib/psych.rb +++ b/lib/psych.rb @@ -1,8 +1,8 @@ # frozen_string_literal: true -require 'psych/versions' +require_relative 'psych/versions' case RUBY_ENGINE when 'jruby' - require 'psych_jars' + require_relative 'psych_jars' if JRuby::Util.respond_to?(:load_ext) JRuby::Util.load_ext('org.jruby.ext.psych.PsychLibrary') else @@ -12,21 +12,21 @@ when 'jruby' else require 'psych.so' end -require 'psych/nodes' -require 'psych/streaming' -require 'psych/visitors' -require 'psych/handler' -require 'psych/tree_builder' -require 'psych/parser' -require 'psych/omap' -require 'psych/set' -require 'psych/coder' -require 'psych/core_ext' -require 'psych/stream' -require 'psych/json/tree_builder' -require 'psych/json/stream' -require 'psych/handlers/document_stream' -require 'psych/class_loader' +require_relative 'psych/nodes' +require_relative 'psych/streaming' +require_relative 'psych/visitors' +require_relative 'psych/handler' +require_relative 'psych/tree_builder' +require_relative 'psych/parser' +require_relative 'psych/omap' +require_relative 'psych/set' +require_relative 'psych/coder' +require_relative 'psych/core_ext' +require_relative 'psych/stream' +require_relative 'psych/json/tree_builder' +require_relative 'psych/json/stream' +require_relative 'psych/handlers/document_stream' +require_relative 'psych/class_loader' ### # = Overview diff --git a/lib/psych/class_loader.rb b/lib/psych/class_loader.rb index 088373c..c2e4ea4 100644 --- a/lib/psych/class_loader.rb +++ b/lib/psych/class_loader.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -require 'psych/omap' -require 'psych/set' +require_relative 'omap' +require_relative 'set' module Psych class ClassLoader # :nodoc: diff --git a/lib/psych/core_ext.rb b/lib/psych/core_ext.rb index 81055cc..0721a13 100644 --- a/lib/psych/core_ext.rb +++ b/lib/psych/core_ext.rb @@ -15,5 +15,5 @@ class Object end if defined?(::IRB) - require 'psych/y' + require_relative 'y' end diff --git a/lib/psych/handlers/document_stream.rb b/lib/psych/handlers/document_stream.rb index 67da794..b77115d 100644 --- a/lib/psych/handlers/document_stream.rb +++ b/lib/psych/handlers/document_stream.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -require 'psych/tree_builder' +require_relative '../tree_builder' module Psych module Handlers diff --git a/lib/psych/handlers/recorder.rb b/lib/psych/handlers/recorder.rb index a8fc7b1..c98724c 100644 --- a/lib/psych/handlers/recorder.rb +++ b/lib/psych/handlers/recorder.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -require 'psych/handler' +require_relative '../handler' module Psych module Handlers diff --git a/lib/psych/json/stream.rb b/lib/psych/json/stream.rb index 2ebd3d7..24dd4b9 100644 --- a/lib/psych/json/stream.rb +++ b/lib/psych/json/stream.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -require 'psych/json/ruby_events' -require 'psych/json/yaml_events' +require_relative 'ruby_events' +require_relative 'yaml_events' module Psych module JSON diff --git a/lib/psych/json/tree_builder.rb b/lib/psych/json/tree_builder.rb index 5c2ee8c..9a45f6b 100644 --- a/lib/psych/json/tree_builder.rb +++ b/lib/psych/json/tree_builder.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -require 'psych/json/yaml_events' +require_relative 'yaml_events' module Psych module JSON diff --git a/lib/psych/nodes.rb b/lib/psych/nodes.rb index 5842c2e..2fa52e0 100644 --- a/lib/psych/nodes.rb +++ b/lib/psych/nodes.rb @@ -1,11 +1,11 @@ # frozen_string_literal: true -require 'psych/nodes/node' -require 'psych/nodes/stream' -require 'psych/nodes/document' -require 'psych/nodes/sequence' -require 'psych/nodes/scalar' -require 'psych/nodes/mapping' -require 'psych/nodes/alias' +require_relative 'nodes/node' +require_relative 'nodes/stream' +require_relative 'nodes/document' +require_relative 'nodes/sequence' +require_relative 'nodes/scalar' +require_relative 'nodes/mapping' +require_relative 'nodes/alias' module Psych ### diff --git a/lib/psych/nodes/node.rb b/lib/psych/nodes/node.rb index 05cb08d..1f84162 100644 --- a/lib/psych/nodes/node.rb +++ b/lib/psych/nodes/node.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true require 'stringio' -require 'psych/class_loader' -require 'psych/scalar_scanner' +require_relative '../class_loader' +require_relative '../scalar_scanner' module Psych module Nodes diff --git a/lib/psych/syntax_error.rb b/lib/psych/syntax_error.rb index 1598e6f..a4c9c4a 100644 --- a/lib/psych/syntax_error.rb +++ b/lib/psych/syntax_error.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -require 'psych/exception' +require_relative 'exception' module Psych class SyntaxError < Psych::Exception diff --git a/lib/psych/tree_builder.rb b/lib/psych/tree_builder.rb index 47a1695..414ca02 100644 --- a/lib/psych/tree_builder.rb +++ b/lib/psych/tree_builder.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -require 'psych/handler' +require_relative 'handler' module Psych ### diff --git a/lib/psych/visitors.rb b/lib/psych/visitors.rb index e2b084d..508290d 100644 --- a/lib/psych/visitors.rb +++ b/lib/psych/visitors.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true -require 'psych/visitors/visitor' -require 'psych/visitors/to_ruby' -require 'psych/visitors/emitter' -require 'psych/visitors/yaml_tree' -require 'psych/visitors/json_tree' -require 'psych/visitors/depth_first' +require_relative 'visitors/visitor' +require_relative 'visitors/to_ruby' +require_relative 'visitors/emitter' +require_relative 'visitors/yaml_tree' +require_relative 'visitors/json_tree' +require_relative 'visitors/depth_first' diff --git a/lib/psych/visitors/json_tree.rb b/lib/psych/visitors/json_tree.rb index 9912cb1..979fc10 100644 --- a/lib/psych/visitors/json_tree.rb +++ b/lib/psych/visitors/json_tree.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -require 'psych/json/ruby_events' +require_relative '../json/ruby_events' module Psych module Visitors diff --git a/lib/psych/visitors/to_ruby.rb b/lib/psych/visitors/to_ruby.rb index 4de7f80..4c1f561 100644 --- a/lib/psych/visitors/to_ruby.rb +++ b/lib/psych/visitors/to_ruby.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true -require 'psych/scalar_scanner' -require 'psych/class_loader' -require 'psych/exception' +require_relative '../scalar_scanner' +require_relative '../class_loader' +require_relative '../exception' unless defined?(Regexp::NOENCODING) Regexp::NOENCODING = 32 diff --git a/lib/psych/visitors/yaml_tree.rb b/lib/psych/visitors/yaml_tree.rb index 2eee4d3..316a3a9 100644 --- a/lib/psych/visitors/yaml_tree.rb +++ b/lib/psych/visitors/yaml_tree.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true -require 'psych/tree_builder' -require 'psych/scalar_scanner' -require 'psych/class_loader' +require_relative '../tree_builder' +require_relative '../scalar_scanner' +require_relative '../class_loader' module Psych module Visitors -- cgit v1.2.1