From 9b6903f50b07d85443d2e4717434b1f24a395ea7 Mon Sep 17 00:00:00 2001 From: Issy Long Date: Tue, 23 Jan 2024 21:49:08 +0000 Subject: [PATCH] Fix RuboCop `Style/` group offenses in docs example code --- docs/Cask-Cookbook.md | 4 ++-- docs/Formula-Cookbook.md | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/Cask-Cookbook.md b/docs/Cask-Cookbook.md index 0febfdd21e..694abf8c7f 100644 --- a/docs/Cask-Cookbook.md +++ b/docs/Cask-Cookbook.md @@ -1076,7 +1076,7 @@ we can use: ```ruby version "1.2.3" -url "https://example.com/file-version-#{version.delete('.')}.dmg" +url "https://example.com/file-version-#{version.delete(".")}.dmg" ``` We can also leverage the power of regular expressions. So instead of: @@ -1090,7 +1090,7 @@ we can use: ```ruby version "1.2.3build4" -url "https://example.com/#{version.sub(%r{build\d+}, '')}/file-version-#{version}.dmg" +url "https://example.com/#{version.sub(/build\d+/, "")}/file-version-#{version}.dmg" ``` #### `version` methods diff --git a/docs/Formula-Cookbook.md b/docs/Formula-Cookbook.md index 03c05d3091..ecbe007392 100644 --- a/docs/Formula-Cookbook.md +++ b/docs/Formula-Cookbook.md @@ -271,7 +271,7 @@ And install any bins, and munge their shebang lines, with: ```ruby bin.install libexec/"bin/" -bin.env_script_all_files(libexec/"bin", GEM_HOME: ENV["GEM_HOME"]) +bin.env_script_all_files(libexec/"bin", GEM_HOME: ENV.fetch("GEM_HOME", nil)) ``` ### Python dependencies @@ -730,7 +730,7 @@ class MyDownloadStrategy < SomeHomebrewDownloadStrategy end class Foo < Formula - url "something", :using => MyDownloadStrategy + url "something", using: MyDownloadStrategy end ``` @@ -874,7 +874,7 @@ bin.write_jar_script libexec/jar_file, "jarfile", java_version: "11" ```ruby (bin/"package").write_env_script libexec/"package", PACKAGE_ROOT: libexec -bin.env_script_all_files(libexec/"bin", PERL5LIB: ENV["PERL5LIB"]) +bin.env_script_all_files(libexec/"bin", PERL5LIB: ENV.fetch("PERL5LIB", nil)) ``` ### Rewriting a script shebang