From 0304c47e92278c9f559ce62bacd136cfcffd63a2 Mon Sep 17 00:00:00 2001 From: Roger Oba Date: Fri, 22 Dec 2023 10:54:33 -0300 Subject: [PATCH] Delete code that was only used by Ruby 2.6.x --- lib/arkana/encoder.rb | 1 - lib/arkana/helpers/enumerable.rb | 16 ---------------- spec/kotlin_code_generator_spec.rb | 12 ++---------- spec/swift_code_generator_spec.rb | 12 ++---------- 4 files changed, 4 insertions(+), 37 deletions(-) delete mode 100644 lib/arkana/helpers/enumerable.rb diff --git a/lib/arkana/encoder.rb b/lib/arkana/encoder.rb index 9254677..a059f3c 100644 --- a/lib/arkana/encoder.rb +++ b/lib/arkana/encoder.rb @@ -1,7 +1,6 @@ # frozen_string_literal: true require "arkana/helpers/string" -require "arkana/helpers/enumerable" # The encoder is responsible for finding the env vars for given keys, encoding them, and creating Secrets based on the generated data. module Encoder diff --git a/lib/arkana/helpers/enumerable.rb b/lib/arkana/helpers/enumerable.rb deleted file mode 100644 index fd47fc3..0000000 --- a/lib/arkana/helpers/enumerable.rb +++ /dev/null @@ -1,16 +0,0 @@ -# frozen_string_literal: true - -# Enumerable extensions and utilities. -module Enumerable - # NOTE: This is a backport of Ruby 2.7 filter_map. This method can be deleted when the minimum target Ruby version is 2.7 - # We're not gating against redefining the method (e.g. via `unless Enumerable.method_defined? :filter_map`) because this - # would reduce the code coverage when analysing code coverage on Ruby versions >= 2.7 - def filter_map - return to_enum(:filter_map) unless block_given? - - each_with_object([]) do |item, res| - processed = yield(item) - res << processed if processed - end - end -end diff --git a/spec/kotlin_code_generator_spec.rb b/spec/kotlin_code_generator_spec.rb index ed9dbda..43931fd 100644 --- a/spec/kotlin_code_generator_spec.rb +++ b/spec/kotlin_code_generator_spec.rb @@ -44,16 +44,8 @@ let(:kotlin_sources_dir) { File.join(kotlin_module_dir, "src", "main", config.kotlin_sources_path, config.kotlin_package_name.split(".")) } let(:kotlin_tests_dir) { File.join(kotlin_module_dir, "src", "test", config.kotlin_sources_path, config.kotlin_package_name.split(".")) } - # NOTE: Can't use: - # def path(...) - # Pathname.new(File.join(...)) - # end - # Until the minimum target version is Ruby 2.7 - def path(arg1, arg2, arg3 = nil) - arg1and2 = File.join(arg1, arg2) - return Pathname.new(arg1and2) unless arg3 - - Pathname.new(File.join(arg1and2, arg3)) if arg3 + def path(...) + Pathname.new(File.join(...)) end it "generates all necessary directories and files" do diff --git a/spec/swift_code_generator_spec.rb b/spec/swift_code_generator_spec.rb index 7846bc0..d4f6d74 100644 --- a/spec/swift_code_generator_spec.rb +++ b/spec/swift_code_generator_spec.rb @@ -43,16 +43,8 @@ let(:swift_package_dir) { File.join(config.result_path, config.import_name) } let(:interface_swift_package_dir) { File.join(config.result_path, "#{config.import_name}Interfaces") } - # NOTE: Can't use: - # def path(...) - # Pathname.new(File.join(...)) - # end - # Until the minimum target version is Ruby 2.7 - def path(arg1, arg2, arg3 = nil) - arg1and2 = File.join(arg1, arg2) - return Pathname.new(arg1and2) unless arg3 - - Pathname.new(File.join(arg1and2, arg3)) if arg3 + def path(...) + Pathname.new(File.join(...)) end it "generates all necessary directories and files" do