lib/kumogata/ext/string_ext.rb in kumogata-0.1.8 vs lib/kumogata/ext/string_ext.rb in kumogata-0.1.9
- old
+ new
@@ -23,15 +23,14 @@
end
end
EOS
end
- def camelcase
- self.split(/[-_]/).map {|str|
- str[0, 1].upcase + str[1..-1].downcase
- }.join
- end
-
def encode64
Base64.encode64(self).delete("\n")
+ end
+
+ def undent
+ min_space_num = self.split("\n").delete_if{|s| s=~ /^\s*$/ }.map{|s| s[/^\s+/].length }.min
+ gsub(/^[ \t]{,#{min_space_num}}/, '')
end
end