fontist 3.0.17 → 3.0.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: aa8aac3407b7b54563dc14319ade845a761256f0ce2d324ed9a7a1da7dfe9613
4
- data.tar.gz: 2ec396abab12f551459a0e7455355243c46e0f4359bf2de4f018ebcde46a30e0
3
+ metadata.gz: '0215294c3d206af7354e6fd6f6f4fd0640e0ba68e53c6ef9891d09f646dfc34e'
4
+ data.tar.gz: 35757e455e568ec462f7c9fe9347104ac28b87a2b1140fde946847d5aa283fa1
5
5
  SHA512:
6
- metadata.gz: dd1a4460fc10c117bb6d7fc3dcbced001f83c918c64e70621778575e7edce78544a94fbbbbe5e64f22294e5c0525af723043055feae62f3a21fe299020cdda71
7
- data.tar.gz: 33e5d409a00bd73c39e839a9a9acad2f31aa2dde95697f1ad08ebfc4f0d2aa980cfb8cac95524b8fdc310c1e880546dbf09bb15ebd3060d44a71948821f35db9
6
+ metadata.gz: cf6667f140b7437998eb2d5ae2828e98ca5265f326a274ac00519d7be8e274c59615a6a0ca7d94b425f58a6327367d6939d4c18783068d785cde2937ee99d32a
7
+ data.tar.gz: da9ef27ff12d6d8902f295bca6c8965bcf996f6aeb8a89c63c54b629aca16f34e5f9af8be776509dd35a14594ff7996884e0fc5992f7b4713755f4bb013aba42
data/Gemfile CHANGED
@@ -18,6 +18,11 @@ gem "simplecov"
18
18
  gem "vcr"
19
19
  gem "webmock"
20
20
 
21
+ # Optional YAML engine (consumer-side dependency; needs Ruby >= 3.0,
22
+ # which is above fontist's gemspec floor, so it stays out of the
23
+ # gemspec). When installed, model YAML parses route through it.
24
+ gem "yeptris", require: false
25
+
21
26
  # Profiling tools (development only)
22
27
  # gem "ruby-prof", "~> 1.7"
23
28
  # stackprof uses Unix-specific system calls and doesn't compile on Windows
@@ -1,3 +1,3 @@
1
1
  module Fontist
2
- VERSION = "3.0.17".freeze
2
+ VERSION = "3.0.18".freeze
3
3
  end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Fontist
4
+ module Yaml
5
+ # Model YAML parsing through yeptris's native loader. Measured 4x
6
+ # faster than Psych on formula and index documents (442KB index:
7
+ # 47ms vs 202ms), with parse results verified identical across the
8
+ # full formulas corpus. Dumping stays on the standard adapter.
9
+ class YeptrisAdapter < Lutaml::Yaml::Adapter::StandardAdapter
10
+ def self.parse(yaml, _options = {})
11
+ Yeptris::YAML.load(yaml)
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,5 @@
1
+ module Fontist
2
+ module Yaml
3
+ autoload :YeptrisAdapter, "#{__dir__}/yaml/yeptris_adapter"
4
+ end
5
+ end
@@ -0,0 +1,40 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Fontist
4
+ # Model YAML engine selection.
5
+ #
6
+ # When the yeptris gem is available, model YAML (formula and index
7
+ # documents, via lutaml-model) is parsed through its native loader -
8
+ # measured 4x faster than Psych on those artifacts. The gem is an
9
+ # optional consumer-side dependency (it needs Ruby >= 3.0, above
10
+ # fontist's floor), so absence falls back to Psych silently.
11
+ # FONTIST_YAML=psych forces the standard engine.
12
+ module YamlBackend
13
+ ENV_KEY = "FONTIST_YAML"
14
+
15
+ class << self
16
+ # Returns the activated adapter class, or nil when the standard
17
+ # engine stays in place (flag set, or yeptris unavailable)
18
+ def activate!
19
+ return nil if forced_standard?
20
+ return nil unless yeptris_available?
21
+
22
+ adapter = Yaml::YeptrisAdapter
23
+ Lutaml::Model::AdapterResolver.set_adapter_class(:yaml, adapter)
24
+
25
+ adapter
26
+ end
27
+
28
+ def forced_standard?
29
+ ENV[ENV_KEY] == "psych"
30
+ end
31
+
32
+ def yeptris_available?
33
+ require "yeptris"
34
+ true
35
+ rescue LoadError
36
+ false
37
+ end
38
+ end
39
+ end
40
+ end
data/lib/fontist.rb CHANGED
@@ -11,6 +11,8 @@ require_relative "fontist/from_file_cache"
11
11
  require_relative "fontist/memoizable"
12
12
  require_relative "fontist/path_scanning"
13
13
  require_relative "fontist/utils"
14
+ require_relative "fontist/yaml"
15
+ require_relative "fontist/yaml_backend"
14
16
 
15
17
  module Fontist
16
18
  # Core classes
@@ -282,3 +284,5 @@ module Fontist
282
284
  true
283
285
  end
284
286
  end
287
+
288
+ Fontist::YamlBackend.activate!
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fontist
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.17
4
+ version: 3.0.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
@@ -512,6 +512,9 @@ files:
512
512
  - lib/fontist/version.rb
513
513
  - lib/fontist/windows_fod_metadata.rb
514
514
  - lib/fontist/windows_import_source.rb
515
+ - lib/fontist/yaml.rb
516
+ - lib/fontist/yaml/yeptris_adapter.rb
517
+ - lib/fontist/yaml_backend.rb
515
518
  - lib/tasks/system_fonts.rake
516
519
  - script/capture_system_fonts
517
520
  - script/download_system_indexes