mirror of
https://github.com/donl/homebrew-cask-versions.git
synced 2026-07-17 06:16:47 -06:00
Merge pull request #8336 from rolandwalker/remove_homebrew_start_with
remove `String` monkeypatches: `start_with?` and `undent_…_72`
This commit is contained in:
commit
c396433984
2 changed files with 1 additions and 22 deletions
|
|
@ -8,6 +8,6 @@ module HomebrewArgvExtension
|
|||
end
|
||||
|
||||
def options_only
|
||||
select { |arg| arg.start_with?("-") }
|
||||
select { |arg| arg.match('^-') }
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue