lib/simplabs/excellent/extensions/string.rb in simplabs-excellent-1.2.2 vs lib/simplabs/excellent/extensions/string.rb in simplabs-excellent-1.3.0
- old
+ new
@@ -12,9 +12,14 @@
gsub(/([a-z\d])([A-Z])/,'\1_\2').
tr("-", "_").
downcase
end
+ def lpad(to, with = ' ')
+ return self if self.length >= to
+ "#{with * (to - self.length)}#{self}"
+ end
+
end
end
end