class Object

Public Instance Methods

CJKChar(str) click to toggle source
# File lib/cjk_string.rb, line 35
def CJKChar(str)
  return str if str.is_a? CJKChar

  if str.length > 1
    if str =~ /^(U\+)?([0-9A-Fa-f]+)/
      str = [$2].pack('U')
    else
      raise ArgumentError, 'CJKChar must have length one'
    end
  end

  CJKChar.new(str)
end
CJKString(str) click to toggle source
# File lib/cjk_string.rb, line 49
def CJKString(str)
  if str.is_a? CJKString
    return str
  elsif str.respond_to? :to_cjk
    str = str.to_cjk
  end
  CJKString.new(str.freeze)
end