symbolify 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/README.md +2 -0
- data/lib/symbolify.rb +18 -2
- data/lib/symbolify/version.rb +1 -1
- data/spec/symbolify_spec.rb +18 -0
- data/symbolify.gemspec +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 86f1b09386497498d42a5bc13c1bd0eada8558e1
|
4
|
+
data.tar.gz: 40d18cd726a05c7b8374478dfef7fe1f0269b171
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5ad1e514f138cc49b80c4efb55d5fdfb1181d13a5f1c082f0b65eacdb980014f62c209d4cba852ee948cb75586638ed09e69664aad7f04f94090005c4783b825
|
7
|
+
data.tar.gz: 32296309c2cc61c305997c61cfc038a26f25c8d8480057ea6c9589adcb861bcefefe85e1685118c3d13f3509274c2767c99c6870f2479488025fdb631193e158
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -25,6 +25,8 @@ puts Symbolify.symbolify "\u{200F}" # RLM
|
|
25
25
|
puts Symbolify.symbolify "\u{2067}" # RLI
|
26
26
|
puts Symbolify.symbolify "\u{0300}" # ◌̀
|
27
27
|
puts Symbolify.symbolify " " # ] [
|
28
|
+
puts Symbolify.symbolify "\u{FFF9}" # IAA
|
29
|
+
puts Symbolify.symbolify "\u{FFFC}" # OBJ
|
28
30
|
puts Symbolify.symbolify "\u{E0020}" # TAG ␠
|
29
31
|
puts Symbolify.symbolify "\u{E01D7}" # VS232
|
30
32
|
puts Symbolify.symbolify "\u{E0000}" # n/a
|
data/lib/symbolify.rb
CHANGED
@@ -96,6 +96,14 @@ module Symbolify
|
|
96
96
|
0x2069 => "PDI",
|
97
97
|
}.freeze
|
98
98
|
|
99
|
+
# no official aliases at the time of adding
|
100
|
+
SPECIALS = {
|
101
|
+
0xFFF9 => "IAA",
|
102
|
+
0xFFFA => "IAS",
|
103
|
+
0xFFFB => "IAT",
|
104
|
+
0xFFFC => "OBJ",
|
105
|
+
}.freeze
|
106
|
+
|
99
107
|
TAG_NAMES = {
|
100
108
|
0xE0001 => "LANG TAG",
|
101
109
|
0xE0020 => "TAG ␠",
|
@@ -530,6 +538,7 @@ module Symbolify
|
|
530
538
|
|
531
539
|
char = char.dup.encode("UTF-8")
|
532
540
|
ord = char.ord
|
541
|
+
char = char[0]
|
533
542
|
|
534
543
|
if char_info.delete?
|
535
544
|
char = CONTROL_DELETE_SYMBOL
|
@@ -545,10 +554,14 @@ module Symbolify
|
|
545
554
|
char = "◌" + char
|
546
555
|
elsif char_info.category == "Me"
|
547
556
|
char = " " + char
|
557
|
+
elsif char_info.separator?
|
558
|
+
char = "⏎"
|
548
559
|
elsif char_info.blank?
|
549
560
|
char = "]" + char + "["
|
550
561
|
elsif TAG_NAMES.key?(ord)
|
551
562
|
char = TAG_NAMES[ord]
|
563
|
+
elsif SPECIALS.key?(ord)
|
564
|
+
char = SPECIALS[ord]
|
552
565
|
end
|
553
566
|
|
554
567
|
char
|
@@ -559,6 +572,7 @@ module Symbolify
|
|
559
572
|
|
560
573
|
ord = char.ord
|
561
574
|
encoding = char_info.encoding
|
575
|
+
char = char[0]
|
562
576
|
no_converter = !!(NO_UTF8_CONVERTER =~ encoding.name)
|
563
577
|
treat_char_unconverted = false
|
564
578
|
|
@@ -588,6 +602,8 @@ module Symbolify
|
|
588
602
|
end
|
589
603
|
|
590
604
|
def self.ascii(char, char_info = AsciiCharacteristics.new(char))
|
605
|
+
char = char[0]
|
606
|
+
|
591
607
|
if char_info.delete?
|
592
608
|
char = CONTROL_DELETE_SYMBOL
|
593
609
|
elsif char_info.c0?
|
@@ -600,10 +616,10 @@ module Symbolify
|
|
600
616
|
end
|
601
617
|
|
602
618
|
def self.binary(char, _ = nil)
|
603
|
-
dump(char)
|
619
|
+
dump(char[0])
|
604
620
|
end
|
605
621
|
|
606
622
|
def self.dump(char)
|
607
|
-
char.dump
|
623
|
+
char[0].dump
|
608
624
|
end
|
609
625
|
end
|
data/lib/symbolify/version.rb
CHANGED
data/spec/symbolify_spec.rb
CHANGED
@@ -6,6 +6,10 @@ describe Symbolify do
|
|
6
6
|
it "will show replacement character for invalid characters" do
|
7
7
|
assert_equal "�", Symbolify.symbolify("\x80")
|
8
8
|
end
|
9
|
+
|
10
|
+
it "will only return first character" do
|
11
|
+
assert_equal "a", Symbolify.symbolify("ab")
|
12
|
+
end
|
9
13
|
end
|
10
14
|
|
11
15
|
describe ".unicode" do
|
@@ -37,10 +41,24 @@ describe Symbolify do
|
|
37
41
|
assert_equal " \u{20E3}", Symbolify.symbolify("\u{20E3}")
|
38
42
|
end
|
39
43
|
|
44
|
+
it "replaces uncommon newline characters" do
|
45
|
+
assert_equal "⏎", Symbolify.symbolify("\u{2028}")
|
46
|
+
assert_equal "⏎", Symbolify.symbolify("\u{2029}")
|
47
|
+
end
|
48
|
+
|
40
49
|
it "wraps blanks" do
|
41
50
|
assert_equal "] [", Symbolify.symbolify(" ")
|
42
51
|
end
|
43
52
|
|
53
|
+
it "replaces annotation characters" do
|
54
|
+
assert_equal "IAA", Symbolify.symbolify("\u{FFF9}")
|
55
|
+
assert_equal "IAS", Symbolify.symbolify("\u{FFFA}")
|
56
|
+
end
|
57
|
+
|
58
|
+
it "replaces object replacement character" do
|
59
|
+
assert_equal "OBJ", Symbolify.symbolify("\u{FFFC}")
|
60
|
+
end
|
61
|
+
|
44
62
|
it "replaces tags" do
|
45
63
|
assert_equal "TAG ␠", Symbolify.symbolify("\u{E0020}")
|
46
64
|
end
|
data/symbolify.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: symbolify
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jan Lelis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-03-
|
11
|
+
date: 2017-03-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: characteristics
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '0.
|
19
|
+
version: '0.6'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '0.
|
26
|
+
version: '0.6'
|
27
27
|
description: Safely print all codepoints from Unicode and single-byte encodings.
|
28
28
|
email:
|
29
29
|
- mail@janlelis.de
|