glossarist 2.0.10 → 2.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3603e9187cc51c667cf1a2c3590cd356188849dcc123244003b90b602d86c20a
4
- data.tar.gz: ee4981edbeada9c0478442ab062f444aaa100d31b87a2b800c5c3191e88a7bbb
3
+ metadata.gz: d174478d1fdc030866f09175b1a229e7133ea77005fa00f7b3f46a904a12248e
4
+ data.tar.gz: 54fb2bfcbb816f5514d3bc0c54f3fd37debdbb87af2279b117edffaa3ea77aa7
5
5
  SHA512:
6
- metadata.gz: dd469aff1f5b5698227c49801b66f7caaca3435ec0895a62375ba98c262f59773f87cfdccb778e0d5fcfd07647c284d82213537055bf2f5562072d617f34f6e0
7
- data.tar.gz: 457f0d331fdf88502e9d1c145ad8e6ed75c915c9613d1d77d620e5c8f4fd27a3f10672e9c9a3dbea2740dce12fcdfcf0cad616a267b9d1ecd78e7cb433748109
6
+ metadata.gz: 2ce6fffeda48412bda622570f2eee9ae17065346a520821293f16bf2d29bb4c90674e6a0ce3a7f8e3dc75cb871c9d9308841c318739f0a942ea9d42c108b0ae9
7
+ data.tar.gz: 56ff4885111df64c8fe8a179e15f73164ad1e0dd4651f63ae27685b23fbcb94ae32b1250b82e2fd99430a8fd07a7efc31fcf0f4b284364c2954c802435fea6ca
data/README.adoc CHANGED
@@ -6,6 +6,8 @@
6
6
  Glossarist gem implements the {glossarist_model_url}[Glossarist model] in ruby. All the entities in the model are available as classes and all the attributes are available as methods of those classes.
7
7
  This gem also allows you to read/write data to concept dataset or create your own collection and save that to glossarist model V2 dataset.
8
8
 
9
+ The YAML schema for `concept` and `localized_concept` is available at {glossarist_model_v2_schema_url}[Concept model/yaml_schemas]
10
+
9
11
  == Installation
10
12
 
11
13
  Add this line to your application's Gemfile:
@@ -57,7 +57,7 @@ module Glossarist
57
57
  end
58
58
 
59
59
  def uuid
60
- @uuid ||= Glossarist::Utilities::UUID.uuid_v5(@uuid_namespace, to_h.to_yaml)
60
+ @uuid ||= Glossarist::Utilities::UUID.uuid_v5(@uuid_namespace, to_h_no_uuid.to_yaml)
61
61
  end
62
62
 
63
63
  def related=(related)
@@ -80,14 +80,16 @@ module Glossarist
80
80
  if localized_concepts.is_a?(Hash)
81
81
  @localized_concepts = stringify_keys(localized_concepts)
82
82
  else
83
- localized_concepts.each do |localized_concept|
84
- lang = localized_concept["language_code"].to_s
83
+ localized_concepts.each do |localized_concept_hash|
84
+ lang = localized_concept_hash["language_code"].to_s
85
85
 
86
- @localized_concepts[lang] = Glossarist::Utilities::UUID.uuid_v5(@uuid_namespace, localized_concept.to_h.to_yaml)
87
-
88
- add_localization(
89
- @localized_concept_class.new(localized_concept["data"] || localized_concept),
86
+ localized_concept = add_localization(
87
+ @localized_concept_class.new(localized_concept_hash["data"] || localized_concept_hash),
90
88
  )
89
+
90
+ @localized_concepts[lang] = localization(lang).uuid
91
+
92
+ localized_concept
91
93
  end
92
94
  end
93
95
  end
@@ -139,7 +141,7 @@ module Glossarist
139
141
 
140
142
  alias :l10n :localization
141
143
 
142
- def to_h
144
+ def to_h_no_uuid
143
145
  {
144
146
  "data" => {
145
147
  "identifier" => id,
@@ -147,9 +149,16 @@ module Glossarist
147
149
  "groups" => groups,
148
150
  "sources" => sources&.map(&:to_h),
149
151
  }.compact,
152
+ "related" => related&.map(&:to_h),
153
+ "date_accepted" => date_accepted&.date,
154
+ "status" => status,
150
155
  }.compact
151
156
  end
152
157
 
158
+ def to_h
159
+ to_h_no_uuid.merge("id" => uuid)
160
+ end
161
+
153
162
  def default_designation
154
163
  localized = localization("eng") || localizations.values.first
155
164
  terms = localized&.preferred_terms&.first || localized&.terms&.first
@@ -176,6 +185,7 @@ module Glossarist
176
185
  end
177
186
 
178
187
  def date_accepted
188
+ return nil unless @dates
179
189
  @dates.find { |date| date.accepted? }
180
190
  end
181
191
 
@@ -4,5 +4,5 @@
4
4
  #
5
5
 
6
6
  module Glossarist
7
- VERSION = "2.0.10"
7
+ VERSION = "2.2.0"
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.10
4
+ version: 2.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-03-28 00:00:00.000000000 Z
11
+ date: 2024-11-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: relaton
@@ -169,7 +169,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
169
169
  - !ruby/object:Gem::Version
170
170
  version: '0'
171
171
  requirements: []
172
- rubygems_version: 3.3.26
172
+ rubygems_version: 3.3.27
173
173
  signing_key:
174
174
  specification_version: 4
175
175
  summary: Concept models for terminology glossaries conforming ISO 10241-1.