lib/ruby-vpi/util.rb in ruby-vpi-18.0.0 vs lib/ruby-vpi/util.rb in ruby-vpi-18.0.1

- old
+ new

@@ -1,10 +1,16 @@ +# A small utility library. +#-- +# Copyright 2006 Suraj N. Kurapati +# See the file named LICENSE for details. + class String # Converts this string into a valid Ruby constant name. def to_ruby_const_name self[0, 1].upcase << self[1..-1] end - def rstrip_from a - sub(/#{a}[^#{a}]*$/, '') + # Strips off everything after the given character in this string. + def rstrip_from char + sub(/#{char}[^#{char}]*$/, '') end -end \ No newline at end of file +end