From 0486c560da30586334e712351d093f55b2459c24 Mon Sep 17 00:00:00 2001 From: Lukas Audzevicius Date: Wed, 9 Apr 2025 10:44:45 +0100 Subject: [PATCH 1/2] (MAINT) Remove outdated monkeypatch Removing 8 year old monkeypatch that use to provide temporary support for Ruby 1.8.7. --- lib/puppet-lint/monkeypatches.rb | 51 -------------------------------- 1 file changed, 51 deletions(-) delete mode 100644 lib/puppet-lint/monkeypatches.rb diff --git a/lib/puppet-lint/monkeypatches.rb b/lib/puppet-lint/monkeypatches.rb deleted file mode 100644 index 13200b8f..00000000 --- a/lib/puppet-lint/monkeypatches.rb +++ /dev/null @@ -1,51 +0,0 @@ -begin - '%{test}' % { test: 'replaced' } == 'replaced' -rescue StandardError - # monkeypatch String#% into Ruby 1.8.7 - class String - Percent = instance_method(:%) unless defined?(Percent) - - def %(*a, &) - a.flatten! - - string = case a.last - when Hash - expand(a.pop) - else - self - end - - if a.empty? - string - else - Percent.bind_call(string, a, &) - end - end - - def expand!(vars = {}) - loop do - changed = false - vars.each do |var, value| - var = var.to_s - var.gsub!(%r{[^a-zA-Z0-9_]}, '') - changed = gsub!(%r{%\{#{var}\}}, value.to_s) - end - break unless changed - end - self - end - - def expand(opts = {}) - dup.expand!(opts) - end - end -end - -unless String.respond_to?(:prepend) - # monkeypatch String#prepend into Ruby 1.8.7 - class String - def prepend(lead) - replace("#{lead}#{self}") - end - end -end From 463c5bb7af94cc70ce14d8dd6aa92fe21661a3ac Mon Sep 17 00:00:00 2001 From: Lukas Audzevicius Date: Wed, 9 Apr 2025 10:50:59 +0100 Subject: [PATCH 2/2] removing require --- lib/puppet-lint.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/puppet-lint.rb b/lib/puppet-lint.rb index c89d2a61..7926014d 100644 --- a/lib/puppet-lint.rb +++ b/lib/puppet-lint.rb @@ -11,7 +11,6 @@ require 'puppet-lint/checks' require 'puppet-lint/report/github' require 'puppet-lint/bin' -require 'puppet-lint/monkeypatches' class PuppetLint::NoCodeError < StandardError; end