symbolify 1.1.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 86f1b09386497498d42a5bc13c1bd0eada8558e1
4
- data.tar.gz: 40d18cd726a05c7b8374478dfef7fe1f0269b171
3
+ metadata.gz: 33dcd3ff7675fc32d54da2f264ef1aafed9aac0e
4
+ data.tar.gz: 7d65bbc2175dcd01ccee1d29f0a08c436854b95b
5
5
  SHA512:
6
- metadata.gz: 5ad1e514f138cc49b80c4efb55d5fdfb1181d13a5f1c082f0b65eacdb980014f62c209d4cba852ee948cb75586638ed09e69664aad7f04f94090005c4783b825
7
- data.tar.gz: 32296309c2cc61c305997c61cfc038a26f25c8d8480057ea6c9589adcb861bcefefe85e1685118c3d13f3509274c2767c99c6870f2479488025fdb631193e158
6
+ metadata.gz: 4cd9a38e8b99f2f5ad74f0acb86be7a1115460224eb83b08783203015b16f7c052aa5aea659801ea43c67969ccc7ba7c3732b36b6038622a7fbd5162a9e35f4c
7
+ data.tar.gz: 674266066d76c9110f7530f17319122d1f07045a6014ed7543b2329ec04b3e161e4983c6f9bc5250c002c54838172cdaf144f197d7e233ecb7af9a0ec48456d1
@@ -1,5 +1,10 @@
1
1
  ## CHANGELOG
2
2
 
3
+ ### 1.2.0
4
+
5
+ * Return "n/a*" for unassigned codepoints which are ignorable
6
+ * Change "TAG ␡" to "TAG ✦"
7
+
3
8
  ### 1.1.0
4
9
 
5
10
  * Add special characters (U+FFF9 - U+FFFC)
data/README.md CHANGED
@@ -29,7 +29,8 @@ puts Symbolify.symbolify "\u{FFF9}" # IAA
29
29
  puts Symbolify.symbolify "\u{FFFC}" # OBJ
30
30
  puts Symbolify.symbolify "\u{E0020}" # TAG ␠
31
31
  puts Symbolify.symbolify "\u{E01D7}" # VS232
32
- puts Symbolify.symbolify "\u{E0000}" # n/a
32
+ puts Symbolify.symbolify "\u{D0000}" # n/a
33
+ puts Symbolify.symbolify "\u{E0000}" # n/a*
33
34
  puts Symbolify.symbolify "\u{10FFFF}" # n/c
34
35
  puts Symbolify.symbolify "\x80" # �
35
36
  ```
@@ -201,7 +201,7 @@ module Symbolify
201
201
  0xE007C => "TAG |",
202
202
  0xE007D => "TAG }",
203
203
  0xE007E => "TAG ~",
204
- 0xE007F => "TAG ",
204
+ 0xE007F => "TAG ",
205
205
  }.freeze
206
206
 
207
207
  VARIATION_SELECTOR_NAMES = {
@@ -468,27 +468,6 @@ module Symbolify
468
468
  0xE01EF => "VS256",
469
469
  }.freeze
470
470
 
471
- NONCHARACTERS = [
472
- *0xFDD0..0xFDEF,
473
- 0xFFFE, 0xFFFF,
474
- 0x1FFFE, 0x1FFFF,
475
- 0x2FFFE, 0x2FFFF,
476
- 0x3FFFE, 0x3FFFF,
477
- 0x4FFFE, 0x4FFFF,
478
- 0x5FFFE, 0x5FFFF,
479
- 0x6FFFE, 0x6FFFF,
480
- 0x7FFFE, 0x7FFFF,
481
- 0x8FFFE, 0x8FFFF,
482
- 0x9FFFE, 0x9FFFF,
483
- 0xAFFFE, 0xAFFFF,
484
- 0xBFFFE, 0xBFFFF,
485
- 0xCFFFE, 0xCFFFF,
486
- 0xDFFFE, 0xDFFFF,
487
- 0xEFFFE, 0xEFFFF,
488
- 0xFFFFE, 0xFFFFF,
489
- 0x10FFFE, 0x10FFFF,
490
- ].freeze
491
-
492
471
  INTERESTING_BYTES_ENCODINGS = {
493
472
  0xD8 => /^macCroatian/,
494
473
  0xF0 => /^mac(Iceland|Roman|Turkish)/,
@@ -529,8 +508,10 @@ module Symbolify
529
508
 
530
509
  def self.unicode(char, char_info = UnicodeCharacteristics.new(char))
531
510
  if !char_info.assigned?
532
- if NONCHARACTERS.include?(char.ord)
511
+ if char_info.noncharacter?
533
512
  return "n/c"
513
+ elsif char_info.ignorable?
514
+ return "n/a*"
534
515
  else
535
516
  return "n/a"
536
517
  end
@@ -548,8 +529,10 @@ module Symbolify
548
529
  char = CONTROL_C1_NAMES[ord]
549
530
  elsif char_info.bidi_control?
550
531
  char = BIDI_CONTROL_NAMES[ord]
551
- elsif VARIATION_SELECTOR_NAMES.key?(ord)
532
+ elsif char_info.variation_selector?
552
533
  char = VARIATION_SELECTOR_NAMES[ord]
534
+ elsif char_info.tag?
535
+ char = TAG_NAMES[ord]
553
536
  elsif char_info.category == "Mn"
554
537
  char = "◌" + char
555
538
  elsif char_info.category == "Me"
@@ -558,8 +541,6 @@ module Symbolify
558
541
  char = "⏎"
559
542
  elsif char_info.blank?
560
543
  char = "]" + char + "["
561
- elsif TAG_NAMES.key?(ord)
562
- char = TAG_NAMES[ord]
563
544
  elsif SPECIALS.key?(ord)
564
545
  char = SPECIALS[ord]
565
546
  end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Symbolify
4
- VERSION = "1.1.0".freeze
4
+ VERSION = "1.2.0".freeze
5
5
  UNICODE_VERSION = "9.0.0".freeze
6
6
  end
7
7
 
@@ -72,7 +72,11 @@ describe Symbolify do
72
72
  end
73
73
 
74
74
  it "works with unassigned characters" do
75
- assert_equal "n/a", Symbolify.symbolify("\u{E0000}")
75
+ assert_equal "n/a", Symbolify.symbolify("\u{D0000}")
76
+ end
77
+
78
+ it "adds a * to unassigned characters which are ignorable" do
79
+ assert_equal "n/a*", Symbolify.symbolify("\u{E0000}")
76
80
  end
77
81
  end
78
82
 
@@ -18,5 +18,5 @@ Gem::Specification.new do |gem|
18
18
  gem.require_paths = ["lib"]
19
19
 
20
20
  gem.required_ruby_version = "~> 2.0"
21
- gem.add_dependency "characteristics", "~> 0.6"
21
+ gem.add_dependency "characteristics", "~> 0.7"
22
22
  end
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.1.0
4
+ version: 1.2.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-30 00:00:00.000000000 Z
11
+ date: 2017-03-31 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.6'
19
+ version: '0.7'
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.6'
26
+ version: '0.7'
27
27
  description: Safely print all codepoints from Unicode and single-byte encodings.
28
28
  email:
29
29
  - mail@janlelis.de