module Unicode::DisplayWidth

Constants

DATA_DIR
DATA_FILE
TABLE_FILE
VERSION

Public Class Methods

codepoint(n) click to toggle source
# File lib/unicode/display_width.rb, line 18
def codepoint(n)
  n = n.to_s.unpack('U')[0] unless n.is_a? Integer
  table[n] or raise ArgumentError, 'codepoint not found'
end
Also aliased as: width, of
of(n)
Alias for: codepoint
table() click to toggle source
# File lib/unicode/display_width.rb, line 10
def table
  if defined?(@table) && @table
    @table
  else
    @table = Marshal.load File.respond_to?(:binread) ? File.binread(TABLE_FILE) : File.read(TABLE_FILE)
  end
end
width(n)
Alias for: codepoint