From 0cc60463c386586ed5506fefbe85777793b8df20 Mon Sep 17 00:00:00 2001 From: Roland Walker Date: Sat, 20 Dec 2014 15:22:55 -0500 Subject: [PATCH] remove String class monkeypatches: start_with? and undent_..._72 --- .../Library/Homebrew/extend/ARGV.rb | 2 +- .../Library/Homebrew/extend/string.rb | 21 ------------------- 2 files changed, 1 insertion(+), 22 deletions(-) diff --git a/lib/homebrew-fork/Library/Homebrew/extend/ARGV.rb b/lib/homebrew-fork/Library/Homebrew/extend/ARGV.rb index cb5ebc7a7..2f05a195f 100644 --- a/lib/homebrew-fork/Library/Homebrew/extend/ARGV.rb +++ b/lib/homebrew-fork/Library/Homebrew/extend/ARGV.rb @@ -8,6 +8,6 @@ module HomebrewArgvExtension end def options_only - select { |arg| arg.start_with?("-") } + select { |arg| arg.match('^-') } end end diff --git a/lib/homebrew-fork/Library/Homebrew/extend/string.rb b/lib/homebrew-fork/Library/Homebrew/extend/string.rb index 8fb01d5b5..5aab413c0 100644 --- a/lib/homebrew-fork/Library/Homebrew/extend/string.rb +++ b/lib/homebrew-fork/Library/Homebrew/extend/string.rb @@ -3,27 +3,6 @@ class String gsub(/^.{#{(slice(/^ +/) || '').length}}/, '') end - # eg: - # if foo then <<-EOS.undent_________________________________________________________72 - # Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do - # eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad - # minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip - # ex ea commodo consequat. Duis aute irure dolor in reprehenderit in - # voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur - # sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt - # mollit anim id est laborum. - # EOS - alias_method :undent_________________________________________________________72, :undent - - def start_with?(*prefixes) - prefixes.any? do |prefix| - if prefix.respond_to?(:to_str) - prefix = prefix.to_str - self[0, prefix.length] == prefix - end - end - end unless method_defined?(:start_with?) - # String.chomp, but if result is empty: returns nil instead. # Allows `chuzzle || foo` short-circuits. def chuzzle