Class: String
Instance Method Summary collapse
Instance Method Details
#to_short_name(name_length = 20, continue_string = "...") ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/custom_class_objects/ext_string.rb', line 4 def to_short_name(name_length = 20, continue_string = "...") if self.jlength <= name_length return self.dup end new_string = "" self.each_char do |c| new_string << c break if new_string.jlength >= name_length end return new_string << continue_string end |