Class: String
Instance Method Summary collapse
- #blank? ⇒ Boolean
- #dcfirst ⇒ Object
- #multistrip ⇒ Object
- #pluralize(n, b = true) ⇒ Object
- #shortened_email ⇒ Object
- #underline ⇒ Object
Instance Method Details
#blank? ⇒ Boolean
12 |
# File 'lib/lowline.rb', line 12 def blank?; self =~ /\A\s*\z/ end |
#dcfirst ⇒ Object
11 |
# File 'lib/lowline.rb', line 11 def dcfirst; self[0..0].downcase + self[1..-1] end |
#multistrip ⇒ Object
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_email ⇒ Object
18 |
# File 'lib/lowline.rb', line 18 def shortened_email; self =~ /<?(\S+?)@.+/ ? $1 : self end |
#underline ⇒ Object
13 |
# File 'lib/lowline.rb', line 13 def underline; self + "\n" + ("-" * self.length) end |