Class: String

Inherits:
Object show all
Defined in:
lib/lowline.rb

Instance Method Summary collapse

Instance Method Details

#blank?Boolean

Returns:

  • (Boolean)


16
# File 'lib/lowline.rb', line 16

def blank?; self =~ /\A\s*\z/ end

#dcfirstObject



15
# File 'lib/lowline.rb', line 15

def dcfirst; self[0..0].downcase + self[1..-1] end

#multiline(prefix = "", cleanstart = true) ⇒ Object



18
19
20
21
# File 'lib/lowline.rb', line 18

def multiline prefix="", cleanstart=true
  return "" if blank?
  (cleanstart ? "\n" : "") + gsub(/^/, prefix)
end

#multistripObject



26
# File 'lib/lowline.rb', line 26

def multistrip; strip.gsub(/\n\n+/, "\n\n") end

#pluralize(n, b = true) ⇒ Object



22
23
24
25
# File 'lib/lowline.rb', line 22

def pluralize n, b=true
  s = (n == 1 ? self : (self == 'bugfix' ? 'bugfixes' : self + "s")) # oh yeah
  b ? n.to_pretty_s + " " + s : s
end

#underlineObject



17
# File 'lib/lowline.rb', line 17

def underline; self + "\n" + ("-" * self.length) end