Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/terminal/table.rb
Instance Method Summary collapse
Instance Method Details
#tljust(width) ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/terminal/table.rb', line 23 def tljust(width) if width > twidth self + ' ' * (width - twidth) else self end end |
#twidth ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/terminal/table.rb', line 6 def twidth # ❤️ is 2 characters result = -3 * scan('❤️').size chars.inject(result) do |result, c| if c.ord <= 126 result += 1 elsif %w{ • é · ♪ … ω ˊ ˋ }.include?(c) result += 1 elsif Emoji.find_by_unicode(c) result += 1 else result += 2 end end end |