glossarist 2.0.3 → 2.0.5
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_manager.rb +1 -1
- data/lib/glossarist/config.rb +3 -2
- data/lib/glossarist/localized_concept.rb +1 -1
- data/lib/glossarist/managed_concept_collection.rb +2 -2
- data/lib/glossarist/model.rb +3 -4
- data/lib/glossarist/v1_reader.rb +1 -1
- data/lib/glossarist/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 32dd0617dca310b2979fc5d2afb81888c7ec39c09da98c2a5d0a34da56d170b3
|
4
|
+
data.tar.gz: 86be4aa4175439dd7cd85d63673a3db85813fde697733913f819eaa395ad66d5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3a1a28e3ce040c3b2b2b31ee8f61fe831f5bdacc9c1105c42bde7efe7404238e018509e3805a50a31df34f36d8dd7e73c3d15c7921bd0d65d2fc9463d86cc14a
|
7
|
+
data.tar.gz: 1dfffaf4e40421827785ec0f6eb288cc1733a7661cf5a9352000eafa127d4fd6427a6033c37b87d8115414ebc0433091c0c94fedd9c867369d87d2893d2f69ed
|
@@ -36,7 +36,7 @@ module Glossarist
|
|
36
36
|
concept_hash = Psych.safe_load(File.read(filename), permitted_classes: [Date, Time])
|
37
37
|
concept_hash["uuid"] = concept_hash["id"] || File.basename(filename, ".*")
|
38
38
|
|
39
|
-
concept =
|
39
|
+
concept = Config.class_for(:managed_concept).new(concept_hash)
|
40
40
|
concept.localized_concepts.each do |_lang, id|
|
41
41
|
localized_concept = load_localized_concept(id)
|
42
42
|
concept.add_l10n(localized_concept)
|
data/lib/glossarist/config.rb
CHANGED
@@ -8,6 +8,7 @@ module Glossarist
|
|
8
8
|
|
9
9
|
DEFAULT_CLASSES = {
|
10
10
|
localized_concept: Glossarist::LocalizedConcept,
|
11
|
+
managed_concept: Glossarist::ManagedConcept,
|
11
12
|
}.freeze
|
12
13
|
|
13
14
|
attr_reader :registered_classes
|
@@ -28,7 +29,7 @@ module Glossarist
|
|
28
29
|
end
|
29
30
|
|
30
31
|
def register_class(class_name, klass)
|
31
|
-
@registered_classes[class_name] = klass
|
32
|
+
@registered_classes[class_name.to_sym] = klass
|
32
33
|
end
|
33
34
|
|
34
35
|
def extension_attributes
|
@@ -53,7 +54,7 @@ module Glossarist
|
|
53
54
|
end
|
54
55
|
|
55
56
|
def register_extension_attributes(attributes)
|
56
|
-
self.register_extension_attributes(attributes)
|
57
|
+
self.instance.register_extension_attributes(attributes)
|
57
58
|
end
|
58
59
|
end
|
59
60
|
end
|
@@ -17,7 +17,7 @@ module Glossarist
|
|
17
17
|
|
18
18
|
def managed_concepts=(managed_concepts = [])
|
19
19
|
managed_concepts.each do |managed_concept|
|
20
|
-
store(
|
20
|
+
store(Config.class_for(:managed_concept).new(managed_concept))
|
21
21
|
end
|
22
22
|
|
23
23
|
@managed_concepts.values
|
@@ -53,7 +53,7 @@ module Glossarist
|
|
53
53
|
# ManagedConcept ID
|
54
54
|
# @return [ManagedConcept]
|
55
55
|
def fetch_or_initialize(id)
|
56
|
-
fetch(id) or store(
|
56
|
+
fetch(id) or store(Config.class_for(:managed_concept).new(data: { id: id }))
|
57
57
|
end
|
58
58
|
|
59
59
|
# Adds concept to the collection. If collection contains a concept with
|
data/lib/glossarist/model.rb
CHANGED
@@ -18,12 +18,11 @@ module Glossarist
|
|
18
18
|
def set_attribute(name, value)
|
19
19
|
public_send("#{name}=", value)
|
20
20
|
rescue NoMethodError
|
21
|
-
|
22
|
-
|
21
|
+
if Config.extension_attributes.include?(name)
|
22
|
+
extension_attributes[name] = value
|
23
|
+
elsif name.match?(/[A-Z]/) # adding support for camel case
|
23
24
|
name = snake_case(name.to_s).to_sym
|
24
25
|
retry
|
25
|
-
elsif Config.extension_attributes.include?(name)
|
26
|
-
extension_attributes[name] = value
|
27
26
|
else
|
28
27
|
raise ArgumentError, "#{self.class.name} does not have " +
|
29
28
|
"attribute #{name} defined or the attribute is read only."
|
data/lib/glossarist/v1_reader.rb
CHANGED
@@ -10,7 +10,7 @@ module Glossarist
|
|
10
10
|
|
11
11
|
def load_concept_from_file(filename)
|
12
12
|
concept_hash = Psych.safe_load(File.read(filename), permitted_classes: [Date])
|
13
|
-
|
13
|
+
Config.class_for(:managed_concept).new(generate_v2_concept_hash(concept_hash))
|
14
14
|
end
|
15
15
|
|
16
16
|
private
|
data/lib/glossarist/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: glossarist
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-02-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: relaton
|