glossarist-new 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/glossarist/concept.rb +1 -1
- data/lib/glossarist/config.rb +37 -0
- data/lib/glossarist/managed_concept.rb +1 -1
- data/lib/glossarist/version.rb +1 -1
- data/lib/glossarist.rb +8 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f0b88c582178e67916b7058bba75f92a14b5862926188092fa6e539c0eb05ad5
|
4
|
+
data.tar.gz: c7d3c4e294f2f77279e712d865239a824ea84ee8fb2a884e23f935c9ca5b871e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2ed31f71ae7f554ed6e4f32f27f2203d78c66ce95e6f1e33502cc610142d9cef534ba21fe6a01aee37bf75f6d889b61f99780448e12aa591e4454cf73986d891
|
7
|
+
data.tar.gz: aa4f3b7c9882afde4d1bbf541ccf509150e434a63fa0f68314d6f72e48d344a22d73524eed91524b5b81c83105cc9917c5c469a24560c181619fe0c10c827f01
|
data/lib/glossarist/concept.rb
CHANGED
@@ -122,7 +122,7 @@ module Glossarist
|
|
122
122
|
|
123
123
|
hash.values
|
124
124
|
.grep(Hash)
|
125
|
-
.map { |subhash|
|
125
|
+
.map { |subhash| Config.class_for(:localized_concept).from_h(subhash) rescue nil }
|
126
126
|
.compact
|
127
127
|
|
128
128
|
concept.related = hash.dig("related") || []
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "singleton"
|
4
|
+
|
5
|
+
module Glossarist
|
6
|
+
class Config
|
7
|
+
include Singleton
|
8
|
+
|
9
|
+
DEFAULT_CLASSES = {
|
10
|
+
localized_concept: Glossarist::LocalizedConcept,
|
11
|
+
}.freeze
|
12
|
+
|
13
|
+
attr_reader :registered_classes
|
14
|
+
|
15
|
+
def initialize
|
16
|
+
@registered_classes = DEFAULT_CLASSES.dup
|
17
|
+
end
|
18
|
+
|
19
|
+
def class_for(name)
|
20
|
+
@registered_classes[name.to_sym]
|
21
|
+
end
|
22
|
+
|
23
|
+
def register_class(class_name, klass)
|
24
|
+
@registered_classes[class_name] = klass
|
25
|
+
end
|
26
|
+
|
27
|
+
class << self
|
28
|
+
def class_for(name)
|
29
|
+
self.instance.class_for(name)
|
30
|
+
end
|
31
|
+
|
32
|
+
def register_class(class_name, klass)
|
33
|
+
self.instance.register_class(class_name, klass)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -36,7 +36,7 @@ module Glossarist
|
|
36
36
|
end
|
37
37
|
|
38
38
|
def localized_concepts=(localized_concepts_hash)
|
39
|
-
@localized_concepts = localized_concepts_hash.map { |l|
|
39
|
+
@localized_concepts = localized_concepts_hash.map { |l| Config.class_for(:localized_concept).new(l) }.compact
|
40
40
|
|
41
41
|
@localized_concepts.each do |l|
|
42
42
|
add_l10n(l)
|
data/lib/glossarist/version.rb
CHANGED
data/lib/glossarist.rb
CHANGED
@@ -28,8 +28,16 @@ require_relative "glossarist/non_verb_rep"
|
|
28
28
|
|
29
29
|
require_relative "glossarist/collections"
|
30
30
|
|
31
|
+
require_relative "glossarist/config"
|
32
|
+
|
31
33
|
module Glossarist
|
32
34
|
class Error < StandardError; end
|
33
35
|
class InvalidTypeError < StandardError; end
|
34
36
|
# Your code goes here...
|
37
|
+
|
38
|
+
def self.configure
|
39
|
+
config = Glossarist::Config.instance
|
40
|
+
|
41
|
+
yield(config) if block_given?
|
42
|
+
end
|
35
43
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: glossarist-new
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-03-
|
11
|
+
date: 2023-03-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: relaton
|
@@ -97,6 +97,7 @@ files:
|
|
97
97
|
- lib/glossarist/concept_manager.rb
|
98
98
|
- lib/glossarist/concept_set.rb
|
99
99
|
- lib/glossarist/concept_source.rb
|
100
|
+
- lib/glossarist/config.rb
|
100
101
|
- lib/glossarist/designation.rb
|
101
102
|
- lib/glossarist/designation/abbreviation.rb
|
102
103
|
- lib/glossarist/designation/base.rb
|