Class: String

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

Instance Method Summary collapse

Instance Method Details

#blank?Boolean

Returns:

  • (Boolean)


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

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

#dcfirstObject



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

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

#multistripObject



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

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

#pluralize(n, b = true) ⇒ Object



14
15
16
17
# File 'lib/lowline.rb', line 14

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

#shortened_emailObject



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

def shortened_email; self =~ /<?(\S+?)@.+/ ? $1 : self end

#underlineObject



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

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