class String
Public Instance Methods
constantize()
click to toggle source
# File lib/trellohub/core_ext/string.rb, line 14 def constantize Object.const_get(self) end
ljust_with_multibyte(length, padstr = ' ')
click to toggle source
# File lib/trellohub/core_ext/string.rb, line 18 def ljust_with_multibyte(length, padstr = ' ') length > self.width ? "#{self}#{padstr * (length - self.width)}" : self end
Also aliased as: ljust
no_coloring()
click to toggle source
# File lib/trellohub/core_ext/string.rb, line 10 def no_coloring self.gsub(/\e\[\d?\d?;?\d\d?m/, '').gsub(/\e\[0m/, '') end
width()
click to toggle source
# File lib/trellohub/core_ext/string.rb, line 4 def width self.no_coloring.each_char.map { |one_letter| one_letter.ascii_only? ? 1 : 2 }.inject(:+) || 0 end