glossarist 2.0.3 → 2.0.5

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: 6db3243d2a3dee8ab236ac591b088e291f735880421d586cb7b08881b023c7b4
4
- data.tar.gz: 4973495641223a4f88cc5c8c83c239c4979d94d77a8986dfaceaf3165ba78a6b
3
+ metadata.gz: 32dd0617dca310b2979fc5d2afb81888c7ec39c09da98c2a5d0a34da56d170b3
4
+ data.tar.gz: 86be4aa4175439dd7cd85d63673a3db85813fde697733913f819eaa395ad66d5
5
5
  SHA512:
6
- metadata.gz: b731a9514198432b603978107243ab700657c5738a17a4b7a8db543fb92d4fa9f6db0f8b56c3a75b90e8a371f43d2ba2c70de494a2b393185621ad35e0014496
7
- data.tar.gz: 852a6dc42b6332816ddbaeb73eefbb21071c685e9965337100f926a53025e892b938141ecb227c43eb662f614a1d459294860dae0745ab025642d4a1c358201a
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 = ManagedConcept.new(concept_hash)
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)
@@ -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
@@ -54,7 +54,7 @@ module Glossarist
54
54
  "review_date" => review_date,
55
55
  "review_decision_date" => review_decision_date,
56
56
  "review_decision_event" => review_decision_event,
57
- }.compact).merge(@extension_attributes)
57
+ }.compact).merge!(@extension_attributes)
58
58
 
59
59
  hash
60
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(ManagedConcept.new(managed_concept))
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(ManagedConcept.new(data: { id: id }))
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
@@ -18,12 +18,11 @@ module Glossarist
18
18
  def set_attribute(name, value)
19
19
  public_send("#{name}=", value)
20
20
  rescue NoMethodError
21
- # adding support for camel case
22
- if name.match?(/[A-Z]/)
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."
@@ -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
- ManagedConcept.new(generate_v2_concept_hash(concept_hash))
13
+ Config.class_for(:managed_concept).new(generate_v2_concept_hash(concept_hash))
14
14
  end
15
15
 
16
16
  private
@@ -4,5 +4,5 @@
4
4
  #
5
5
 
6
6
  module Glossarist
7
- VERSION = "2.0.3"
7
+ VERSION = "2.0.5"
8
8
  end
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.3
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: 2023-12-27 00:00:00.000000000 Z
11
+ date: 2024-02-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: relaton