glossarist 2.8.17 → 2.8.18

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: ef11d8539b9ee78a318b2ebc07db56194b683d4900aa03bdc3c0d1eb60fdaac9
4
- data.tar.gz: '011642394c30cdd2e3fe28adeda2f43eb8f234b52a25a95493763b6b67c64c83'
3
+ metadata.gz: 329df9970677060f9f81cac4f093d384da792884955b4ee26335339a6df0d36f
4
+ data.tar.gz: 1b94ff574c689ecd72123cb7d879b69bfca401f027dfece4c4ade72ca02b9a4a
5
5
  SHA512:
6
- metadata.gz: 9db668ec9c2bd19547978620c4f202d4ec685d683d40b71ea8b8c85a5da6c426689e1f77339b46c14b6efd659c6b0957a26985c5d083fc67a85788074e387dce
7
- data.tar.gz: ea7f7e228374a184d140c01deeefb5500d15e04397fa9c1109122257f39f12b0209c1e368a60ddbef386281a8ec80647a56bbe5793cbc4e0c8c7bfc027b145f7
6
+ metadata.gz: f4edbf8bf5b20ca8054e3f1fb678b60b19ead2dd0585d2c71b8bafd648b0553b8c917a918f4be97be2bbb535611504d73a5b98c9383a278938a18dee74942c88
7
+ data.tar.gz: 3d83adb27ae450854727c7345dd6d2219ea9abc3449fcb092321093fc0a42aaf709e59c85607dff8c1e36e8c2483bbcfefb48c21cb3673574509c9f108703eec
data/.rubocop_todo.yml CHANGED
@@ -1,6 +1,6 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2026-06-21 09:57:59 UTC using RuboCop version 1.86.1.
3
+ # on 2026-07-02 16:08:41 UTC using RuboCop version 1.86.1.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
@@ -11,7 +11,7 @@ Gemspec/RequiredRubyVersion:
11
11
  Exclude:
12
12
  - 'glossarist.gemspec'
13
13
 
14
- # Offense count: 467
14
+ # Offense count: 469
15
15
  # This cop supports safe autocorrection (--autocorrect).
16
16
  # Configuration parameters: Max, AllowHeredoc, AllowURI, AllowQualifiedName, URISchemes, AllowRBSInlineAnnotation, AllowCopDirectives, AllowedPatterns, SplitStrings.
17
17
  # URISchemes: http, https
@@ -84,9 +84,9 @@ module Glossarist
84
84
  end
85
85
 
86
86
  def date_accepted_to_yaml(model, doc)
87
- if model.date_accepted
88
- doc["date_accepted"] = model.date_accepted.date.iso8601
89
- end
87
+ return unless model.date_accepted
88
+
89
+ doc["date_accepted"] = model.date_accepted.to_yaml_date
90
90
  end
91
91
 
92
92
  def date_accepted_from_yaml(model, value)
@@ -96,10 +96,6 @@ module Glossarist
96
96
  model.data.dates << ConceptDate.of_yaml(
97
97
  { "date" => value, "type" => "accepted" },
98
98
  )
99
-
100
- model.date_accepted = model.data.dates.find do |d|
101
- d.type == "accepted"
102
- end
103
99
  end
104
100
 
105
101
  def uuid
@@ -12,5 +12,12 @@ module Glossarist
12
12
  map :date, to: :date
13
13
  map :type, to: :type
14
14
  end
15
+
16
+ # Returns the date as a string for flat YAML fields such as
17
+ # ManagedConcept#date_accepted. Subclasses whose `date` is not a
18
+ # DateTime override this so callers do not need to type-check.
19
+ def to_yaml_date
20
+ date&.iso8601
21
+ end
15
22
  end
16
23
  end
@@ -63,9 +63,9 @@ module Glossarist
63
63
  end
64
64
 
65
65
  def date_accepted_to_yaml(model, doc)
66
- if model.date_accepted
67
- doc["date_accepted"] = model.date_accepted.date.iso8601
68
- end
66
+ return unless model.date_accepted
67
+
68
+ doc["date_accepted"] = model.date_accepted.to_yaml_date
69
69
  end
70
70
 
71
71
  def uuid_to_yaml(model, doc)
@@ -6,6 +6,7 @@ module Glossarist
6
6
  attribute :sources, V3::ConceptSource,
7
7
  collection: Collections::ConceptSourceCollection,
8
8
  initialize_empty: true
9
+ attribute :dates, V3::ConceptDate, collection: true
9
10
  attribute :definition, V3::DetailedDefinition,
10
11
  collection: Collections::DetailedDefinitionCollection,
11
12
  initialize_empty: true
@@ -0,0 +1,37 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Glossarist
4
+ module V3
5
+ # V3 variant of ConceptDate. The base {Glossarist::ConceptDate} types
6
+ # `date` as `:date_time` (ISO 8601 datetime only), but the v3 schema
7
+ # (`concept-model/schemas/v3/concept.yaml`) declares
8
+ #
9
+ # concept_date:
10
+ # properties:
11
+ # date:
12
+ # type: string
13
+ # format: date
14
+ #
15
+ # which accepts any date string — full ISO 8601 datetime ("2023-01-01T00:00:00+00:00"),
16
+ # calendar date ("2023-01-01"), or year-only ("2023"). Datasets such as
17
+ # the IALA Dictionary (datasets/iala-*/concepts/*.yaml) use year-only
18
+ # strings for accepted/retired lifecycle markers, so the v3 model needs
19
+ # to round-trip those without losing the value.
20
+ #
21
+ # See BUG_REPORT.md for the full investigation.
22
+ class ConceptDate < Glossarist::ConceptDate
23
+ attribute :date, :string
24
+
25
+ key_value do
26
+ map :date, to: :date
27
+ map :type, to: :type
28
+ end
29
+
30
+ # The `date` is already a free-form string in V3, so the wire form
31
+ # is the value itself — no iso8601 coercion.
32
+ def to_yaml_date
33
+ date
34
+ end
35
+ end
36
+ end
37
+ end
@@ -4,6 +4,15 @@ module Glossarist
4
4
  module V3
5
5
  class LocalizedConcept < Glossarist::LocalizedConcept
6
6
  attribute :data, V3::ConceptData, default: -> { V3::ConceptData.new }
7
+
8
+ def date_accepted_from_yaml(model, value)
9
+ return if model.date_accepted
10
+
11
+ model.data.dates ||= []
12
+ model.data.dates << V3::ConceptDate.of_yaml(
13
+ { "date" => value, "type" => "accepted" },
14
+ )
15
+ end
7
16
  end
8
17
  end
9
18
  end
@@ -5,6 +5,8 @@ module Glossarist
5
5
  class ManagedConcept < Glossarist::ManagedConcept
6
6
  attribute :data, V3::ManagedConceptData, default: -> { V3::ManagedConceptData.new }
7
7
  attribute :related, V3::RelatedConcept, collection: true
8
+ attribute :dates, V3::ConceptDate, collection: true
9
+ attribute :date_accepted, V3::ConceptDate
8
10
  attribute :sources, V3::ConceptSource, collection: true
9
11
 
10
12
  key_value do
@@ -19,6 +21,12 @@ module Glossarist
19
21
  map :schema_version, to: :schema_version
20
22
  map :sources, to: :sources
21
23
  end
24
+
25
+ def date_accepted_from_yaml(model, value)
26
+ model.date_accepted = V3::ConceptDate.of_yaml(
27
+ { "date" => value, "type" => "accepted" },
28
+ )
29
+ end
22
30
  end
23
31
  end
24
32
  end
data/lib/glossarist/v3.rb CHANGED
@@ -4,6 +4,7 @@ module Glossarist
4
4
  module V3
5
5
  autoload :Configuration, "glossarist/v3/configuration"
6
6
  autoload :Citation, "glossarist/v3/citation"
7
+ autoload :ConceptDate, "glossarist/v3/concept_date"
7
8
  autoload :ConceptSource, "glossarist/v3/concept_source"
8
9
  autoload :DetailedDefinition, "glossarist/v3/detailed_definition"
9
10
  autoload :ConceptRef, "glossarist/v3/concept_ref"
@@ -15,6 +16,7 @@ module Glossarist
15
16
  autoload :ConceptDocument, "glossarist/v3/concept_document"
16
17
 
17
18
  Configuration.register_model(Citation, id: :citation)
19
+ Configuration.register_model(ConceptDate, id: :concept_date)
18
20
  Configuration.register_model(ConceptSource, id: :concept_source)
19
21
  Configuration.register_model(DetailedDefinition, id: :detailed_definition)
20
22
  Configuration.register_model(ConceptData, id: :concept_data)
@@ -4,5 +4,5 @@
4
4
  #
5
5
 
6
6
  module Glossarist
7
- VERSION = "2.8.17"
7
+ VERSION = "2.8.18"
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.8.17
4
+ version: 2.8.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2026-06-21 00:00:00.000000000 Z
11
+ date: 2026-07-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: lutaml-model
@@ -339,6 +339,7 @@ files:
339
339
  - lib/glossarist/v3.rb
340
340
  - lib/glossarist/v3/citation.rb
341
341
  - lib/glossarist/v3/concept_data.rb
342
+ - lib/glossarist/v3/concept_date.rb
342
343
  - lib/glossarist/v3/concept_document.rb
343
344
  - lib/glossarist/v3/concept_ref.rb
344
345
  - lib/glossarist/v3/concept_source.rb