mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
16 lines
309 B
Ruby
16 lines
309 B
Ruby
![]() |
# frozen_string_literal: true
|
||
|
|
||
|
class String
|
||
|
module Compat
|
||
|
# String.chomp, but if result is empty: returns nil instead.
|
||
|
# Allows `chuzzle || foo` short-circuits.
|
||
|
def chuzzle
|
||
|
odeprecated "chuzzle", "chomp.presence"
|
||
|
s = chomp
|
||
|
s unless s.empty?
|
||
|
end
|
||
|
end
|
||
|
|
||
|
prepend Compat
|
||
|
end
|