lib/lite/ruby/string.rb in lite-ruby-1.0.3 vs lib/lite/ruby/string.rb in lite-ruby-1.0.4

- old
+ new

@@ -102,9 +102,18 @@ def deconstantize! replace(deconstantize) end + def dedupe(pattern) + dup.dedupe!(pattern) + end + + def dedupe!(pattern) + pattern.each_char { |char| gsub!(/#{Regexp.escape(char)}{2,}/, char) } + self + end + def demodulize gsub(/^.*::/, '') end def demodulize!