Sha256: 44d4fc70fa3874449eccedc230475650596633c5b6be6500b1098503237e5903
Contents?: true
Size: 677 Bytes
Versions: 26
Compression:
Stored size: 677 Bytes
Contents
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 end end def ltrunc!(max) replace ltrunc(max) end end end end class ::String include Doing::Completion::StringUtils end
Version data entries
26 entries across 26 versions & 1 rubygems