Sha256: 7a6081b25dd1cdbe7b1f8947de54d351b443ae4e93b48a1a2f30e614a3cbba6e
Contents?: true
Size: 541 Bytes
Versions: 1
Compression:
Stored size: 541 Bytes
Contents
require "yaml" module Ascii class Codepoint attr_reader :code GROUPS = Hash.new do |hash, group_name| filename = File.expand_path("../../../data/#{group_name}.yml", __FILE__) hash[name] = YAML.load_file(filename) end def initialize(char) @code = char.unpack("U").first end def decode group.at(group_index) end private def group GROUPS[group_name] end def group_name "x%02x" % (code >> 8) end def group_index code & 255 end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ascii-1.0.0 | lib/ascii/codepoint.rb |