Class: String

Inherits:
Object
  • Object
show all
Defined in:
Library/Homebrew/cmd/irb.rb,
Library/Homebrew/extend/string.rb

Direct Known Subclasses

Hbc::DSL::Version

Instance Method Summary collapse

Instance Method Details

#chuzzleObject

String.chomp, but if result is empty: returns nil instead. Allows chuzzle || foo short-circuits.



7
8
9
10
# File 'Library/Homebrew/extend/string.rb', line 7

def chuzzle
  s = chomp
  s unless s.empty?
end

#f(*args) ⇒ Object



17
18
19
# File 'Library/Homebrew/cmd/irb.rb', line 17

def f(*args)
  Formulary.factory(self, *args)
end

#strip_prefix(prefix) ⇒ Object



12
13
14
# File 'Library/Homebrew/extend/string.rb', line 12

def strip_prefix(prefix)
  start_with?(prefix) ? self[prefix.length..-1] : self
end