glossarist 2.0.2 → 2.0.4

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: 550f2f9abb0af4adf53b54b99bb00eb40b7bac9b1a3dfb96971a2819f524d0af
4
- data.tar.gz: 58f56b76ae70724248439a06ed2bd45d851cb1e3a135c4e6488efc2c918c7e88
3
+ metadata.gz: 93a350e5e964f972f6b37865cf7cb7d452b0e8281429718b7f8121feceaccd2d
4
+ data.tar.gz: a474d840ee6d35ee6781f252f678b45fc05835b9915588b151715fe8ef8d5874
5
5
  SHA512:
6
- metadata.gz: c3d0e053d7da22e44b70ca26bddfc20981cc03d62a13584d17e1f8883cd072f46ec172c46808437e4d73956a2faf4d61adb51b61a486772d52a6e2339030b400
7
- data.tar.gz: 1ea25c4c4ffcc7171cc60e58ba3a4e478d4e0b734037faafcc29790176a1bc72758d79323fa3c5b8365de270f5672a02f4d55c8e5275c0361610f6e2850bfea0
6
+ metadata.gz: 75e5f037aa510ad73388b255039c6256d38a057387eb9584f2d3412635f9701719ac8fb1a91be476a8091543cd2366598e4831a84ee066e85fa24173e361117a
7
+ data.tar.gz: 073b9bd4562d657d7ccfe8adde06de7727e5bd14c51e8cbcbdeef7924619dcee2b23f51538e67e6a859e00f4b15933b631c2d315abaad4e8a20d5fb200842efb
@@ -33,7 +33,7 @@ module Glossarist
33
33
  end
34
34
 
35
35
  def load_concept_from_file(filename)
36
- concept_hash = Psych.safe_load(File.read(filename), permitted_classes: [Date])
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
39
  concept = ManagedConcept.new(concept_hash)
@@ -50,7 +50,7 @@ module Glossarist
50
50
  def load_localized_concept(id)
51
51
  concept_hash = Psych.safe_load(
52
52
  File.read(localized_concept_path(id)),
53
- permitted_classes: [Date],
53
+ permitted_classes: [Date, Time],
54
54
  )
55
55
  concept_hash["uuid"] = id
56
56
 
@@ -28,7 +28,7 @@ module Glossarist
28
28
  end
29
29
 
30
30
  def register_class(class_name, klass)
31
- @registered_classes[class_name] = klass
31
+ @registered_classes[class_name.to_sym] = klass
32
32
  end
33
33
 
34
34
  def extension_attributes
@@ -53,7 +53,7 @@ module Glossarist
53
53
  end
54
54
 
55
55
  def register_extension_attributes(attributes)
56
- self.register_extension_attributes(attributes)
56
+ self.instance.register_extension_attributes(attributes)
57
57
  end
58
58
  end
59
59
  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
@@ -28,6 +28,10 @@ module Glossarist
28
28
  # @return [Array<String>]
29
29
  attr_reader :groups
30
30
 
31
+ # List of authorative sources.
32
+ # @return [Array<ConceptSource>]
33
+ attr_reader :sources
34
+
31
35
  # All localizations for this concept.
32
36
  #
33
37
  # Keys are language codes and values are instances of {LocalizedConcept}.
@@ -87,6 +91,12 @@ module Glossarist
87
91
  end
88
92
  end
89
93
 
94
+ def sources=(sources)
95
+ @sources = sources&.map do |source|
96
+ ConceptSource.new(source)
97
+ end || []
98
+ end
99
+
90
100
  def localizations=(localizations)
91
101
  return unless localizations
92
102
 
@@ -134,6 +144,7 @@ module Glossarist
134
144
  "identifier" => id,
135
145
  "localized_concepts" => localized_concepts.empty? ? nil : localized_concepts,
136
146
  "groups" => groups,
147
+ "sources" => sources&.map(&:to_h),
137
148
  }.compact,
138
149
  }.compact
139
150
  end
@@ -182,6 +193,7 @@ module Glossarist
182
193
  localizedConcepts
183
194
  localizations
184
195
  groups
196
+ sources
185
197
  ].compact
186
198
  end
187
199
 
@@ -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."
@@ -4,5 +4,5 @@
4
4
  #
5
5
 
6
6
  module Glossarist
7
- VERSION = "2.0.2"
7
+ VERSION = "2.0.4"
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.2
4
+ version: 2.0.4
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-01 00:00:00.000000000 Z
11
+ date: 2024-02-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: relaton