class String
Public Instance Methods
blue()
click to toggle source
# File lib/bam/prelude.rb, line 62 def blue; self end
bold()
click to toggle source
# File lib/bam/prelude.rb, line 64 def bold; self end
classify()
click to toggle source
# File lib/bam/prelude.rb, line 11 def classify split('_').collect(&:capitalize).join end
comment()
click to toggle source
# File lib/bam/prelude.rb, line 43 def comment "// " + gsub(/[\r\n]/,"\n// ") end
fmt()
click to toggle source
# File lib/bam/prelude.rb, line 35 def fmt self.split.join(' ').gsub(/\s*;/, ';') end
green()
click to toggle source
# File lib/bam/prelude.rb, line 61 def green; self end
hilite()
click to toggle source
# File lib/bam/prelude.rb, line 47 def hilite underline end
hyphenate()
click to toggle source
# File lib/bam/prelude.rb, line 23 def hyphenate split('_').join('-') end
indent(n = 2)
click to toggle source
# File lib/bam/prelude.rb, line 39 def indent(n = 2) (" " * n) + gsub(/[\r\n]/,"\n#{" " * n}") end
light_black()
click to toggle source
# File lib/bam/prelude.rb, line 63 def light_black; self end
nounify()
click to toggle source
# File lib/bam/prelude.rb, line 31 def nounify split('_').collect(&:capitalize).join(' ') end
red()
click to toggle source
# File lib/bam/prelude.rb, line 60 def red; self end
to_range()
click to toggle source
# File lib/bam/prelude.rb, line 2 def to_range case self when /\d+\.\.\d+/ split(/\.\./).inject{|i,j| i.to_i..j.to_i} else to_i..to_i end end
unclassify()
click to toggle source
# File lib/bam/prelude.rb, line 15 def unclassify self.gsub(/::/, '/'). gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2'). gsub(/([a-z\d])([A-Z])/,'\1_\2'). tr("-", "_"). downcase end
underline()
click to toggle source
# File lib/bam/prelude.rb, line 65 def underline; self end
unhyphenate()
click to toggle source
# File lib/bam/prelude.rb, line 27 def unhyphenate split('-').join('_') end
yellow()
click to toggle source
# File lib/bam/prelude.rb, line 59 def yellow; self end