lib/symbolify.rb in symbolify-1.0.0 vs lib/symbolify.rb in symbolify-1.1.0

- old
+ new

@@ -94,10 +94,18 @@ 0x2067 => "RLI", 0x2068 => "FSI", 0x2069 => "PDI", }.freeze + # no official aliases at the time of adding + SPECIALS = { + 0xFFF9 => "IAA", + 0xFFFA => "IAS", + 0xFFFB => "IAT", + 0xFFFC => "OBJ", + }.freeze + TAG_NAMES = { 0xE0001 => "LANG TAG", 0xE0020 => "TAG ␠", 0xE0021 => "TAG !", 0xE0022 => "TAG \"", @@ -528,10 +536,11 @@ end end char = char.dup.encode("UTF-8") ord = char.ord + char = char[0] if char_info.delete? char = CONTROL_DELETE_SYMBOL elsif char_info.c0? char = CONTROL_C0_SYMBOLS[ord] @@ -543,24 +552,29 @@ char = VARIATION_SELECTOR_NAMES[ord] elsif char_info.category == "Mn" char = "◌" + char elsif char_info.category == "Me" char = " " + char + elsif char_info.separator? + char = "⏎" elsif char_info.blank? char = "]" + char + "[" elsif TAG_NAMES.key?(ord) char = TAG_NAMES[ord] + elsif SPECIALS.key?(ord) + char = SPECIALS[ord] end char end def self.byte(char, char_info= ByteCharacteristics.new(char)) return "n/a" if !char_info.assigned? ord = char.ord encoding = char_info.encoding + char = char[0] no_converter = !!(NO_UTF8_CONVERTER =~ encoding.name) treat_char_unconverted = false if char_info.delete? char = CONTROL_DELETE_SYMBOL @@ -586,10 +600,12 @@ char.encode("UTF-8") end end def self.ascii(char, char_info = AsciiCharacteristics.new(char)) + char = char[0] + if char_info.delete? char = CONTROL_DELETE_SYMBOL elsif char_info.c0? char = CONTROL_C0_SYMBOLS[char.ord] elsif char_info.blank? @@ -598,12 +614,12 @@ char end def self.binary(char, _ = nil) - dump(char) + dump(char[0]) end def self.dump(char) - char.dump + char[0].dump end end