lib/doing/completion/completion_string.rb in doing-2.1.58 vs lib/doing/completion/completion_string.rb in doing-2.1.60

- old
+ new

@@ -1,11 +1,22 @@ module Doing module Completion module StringUtils + + ## + ## Get short description for command completion + ## + ## @return [String] Short description + ## def short_desc split(/[,.]/)[0].sub(/ \(.*?\)?$/, '').strip end + ## + ## Truncate string from left + ## + ## @param max The maximum number of characters + ## def ltrunc(max) if length > max sub(/^.*?(.{#{max - 3}})$/, '...\1') else self