Module: BabelBridge::StringExtensions

Included in:
String
Defined in:
lib/string.rb

Instance Method Summary collapse

Instance Method Details

#camelizeObject



3
4
5
# File 'lib/string.rb', line 3

def camelize
  self.split("_").collect {|a| a.capitalize}.join
end

#first_lines(n) ⇒ Object



7
8
9
10
# File 'lib/string.rb', line 7

def first_lines(n)
  lines=self.split("\n",-1)
  lines.length<=n ? self : lines[0..n-1].join("\n")
end

#last_lines(n) ⇒ Object



12
13
14
15
# File 'lib/string.rb', line 12

def last_lines(n)
  lines=self.split("\n",-1)
  lines.length<=n ? self : lines[-n..-1].join("\n")
end