relaton-render 3.0.0.pre.alpha.31 → 3.0.0.pre.alpha.32

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: e50fb4bacd89f6ca82b53a110f58e73e8c7fee162ce7ee712aad0515c01cc1ad
4
- data.tar.gz: 64d2bbc56979a832374002a3a9dde0115903ca7c793228af46b0f6e8cd1d4d95
3
+ metadata.gz: a4910f5153470cbaeb2050385fe5b2fb310f0d8028e64a946c419b3fd3d772df
4
+ data.tar.gz: ea045152f9a08da7b2548df4c41bcd39fa6195d4bcffc9119231ccdd85a91743
5
5
  SHA512:
6
- metadata.gz: a7f069c5015bd59b9834472adbb60c9f0f67c0c248aa02d265bd5e4f37ac9f0f9b4920e6a57efaa16b91430d9f1991b0a71112f9c14f7d8900c42495b26f5d67
7
- data.tar.gz: d7c33b582fc403401644a2e82f4cb8727a0ef8d27a3a02ce12261f70bf8e52dc901a72c20ba2c10aaec735a8f1c53d5bf510adb87e28ee746b401502831d008e
6
+ metadata.gz: 99e29f76607ff8c1e0b84ef5fbf9fb56c9291bb87c0ecb6d771679d2a9a7f12aaa0140692fdef6f665bdd9b9e278feaf59d2466591843ada74fc4d68740bd951
7
+ data.tar.gz: b5a937aae90ad6771126ece89b64bce89dc92f7fa60bebdca3719885197878125fa4d579e89990f13bc94111fc0b82dcb901d59b490ea00acca95cf8c6fccce5
@@ -14,14 +14,16 @@ module Relaton
14
14
  def render
15
15
  return "#{@i18n.label('version')} #{raw}" unless word_edition?
16
16
 
17
- # The worded forms first ("First edition", "第N版" via the
18
- # ordinal template), the cardinal last
19
- ordinal = locale_template("edition_ordinal", number)
20
- return ordinal if ordinal
21
-
17
+ # The exact worded forms first ("first edition", "第1版"),
18
+ # then the generic ordinal template, the cardinal last: a
19
+ # specific label outranks a template that would apply to
20
+ # any number
22
21
  word = @i18n.label("edition_#{number}")
23
22
  return word unless word == "edition_#{number}"
24
23
 
24
+ ordinal = locale_template("edition_ordinal", number)
25
+ return ordinal if ordinal
26
+
25
27
  cardinal_form || "#{ordinalize(number)} #{@i18n.label('edition')}"
26
28
  end
27
29
 
@@ -39,12 +39,18 @@ module Relaton
39
39
  "available_at" => "available_from",
40
40
  }.freeze
41
41
 
42
- def label_map
43
- base = LABEL_FOR.filter_map do |attr, label|
42
+ # The named attributes' label map alone: a delta's named
43
+ # attribute (availableAt) outranks the base pack's labels
44
+ # hash carrying the same label key
45
+ def named_label_map
46
+ LABEL_FOR.filter_map do |attr, label|
44
47
  value = public_send(attr)
45
48
  [label, value] unless value.nil?
46
49
  end.to_h
47
- base.merge(labels || {})
50
+ end
51
+
52
+ def label_map
53
+ named_label_map.merge(labels || {})
48
54
  end
49
55
  end
50
56
  end
@@ -176,7 +176,12 @@ module Relaton
176
176
  locale.in_str ||= base_locale.in_str
177
177
  locale.at ||= base_locale.at
178
178
  locale.available_at ||= base_locale.available_at
179
- locale.labels.merge!(base_locale.label_map) { |_k, _b, d| d }
179
+ # delta labels win per key; the base's label map only fills
180
+ # gaps. Hash#merge! yields |key, receiver, other|, so the
181
+ # delta value is the second argument.
182
+ locale.labels.merge!(base_locale.label_map) { |_k, delta, _base| delta }
183
+ # a delta's named attributes assert over the inherited labels
184
+ locale.named_label_map.each_key { |k| locale.labels.delete(k) }
180
185
  locale.punct = (base_locale.punct || {}).merge(locale.punct || {})
181
186
  end
182
187
 
@@ -1,5 +1,5 @@
1
1
  module Relaton
2
2
  module Render
3
- VERSION = "3.0.0.pre.alpha.31".freeze
3
+ VERSION = "3.0.0.pre.alpha.32".freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: relaton-render
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0.pre.alpha.31
4
+ version: 3.0.0.pre.alpha.32
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2026-10-08 00:00:00.000000000 Z
11
+ date: 2026-10-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: htmlentities