page_meta 2.0.0 → 2.0.1

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: 30f096278376e70c56074428c6ec88f786a6a1ac893a8da66829884efc9e34dc
4
- data.tar.gz: 4d635e8a75a48be6acedd134df338e73085f0f7f8326143b9bcfc8436ffc12e0
3
+ metadata.gz: f948175f35af9b5f92902225e895d0e7c7fe664afd54f3ca8d6d82fc77c9b2c5
4
+ data.tar.gz: 6034bbcff7b2079c8f234e447ffc8804bfda09989874a66952bc467765cc7b1c
5
5
  SHA512:
6
- metadata.gz: 24cf0db7b385568fcc471bc390b85b3d6c5e24972c5d54bd0cce251f9ee1058f917c096534f4bccd7f66f220e9efdcfa3d87c75c4dbf9c0a3d6ac0afe576a758
7
- data.tar.gz: bcdefe6bbc2b57010848b2466023b3f1da305e9d745715f2373aeac33c9bf2ff9220edfb9c298772d11dd49f443c7985f91a0c431156e7917009ca7505b1d9d2
6
+ metadata.gz: '06529e97cbaf313bd71be194e578cc8ce3f3c1f8d3b646fa1b71adf10bb81f7c3f31584683f29c64f158dd7ee6e4e196ac5a5e6cb548372911cc278e8a9d1d2a'
7
+ data.tar.gz: e9d86f55d916c7b2d4b4cd2bd9d8161caf089733df76811a3e735cee1b5f1a0c777406fde3599879e0a04774b88274853ee5c598200481a2782f3e7fbda07b50
data/CHANGELOG.md CHANGED
@@ -11,7 +11,13 @@ Prefix your message with one of the following:
11
11
  - [Security] in case of vulnerabilities.
12
12
  -->
13
13
 
14
- ## Unreleased
14
+ ## 2.0.1
15
+
16
+ - [Removed] Support for old format.
17
+ - [Added] Support for custom base scope targeting controller or controller +
18
+ action.
19
+
20
+ ## 2.0.0
15
21
 
16
22
  - [Added] Add support for placeholders in base title.
17
23
  - [Changed] Set minimum ruby version to 3.2.
@@ -78,13 +78,13 @@ module PageMeta
78
78
 
79
79
  # The title translation.
80
80
  def title
81
- @title ||= Translator.new(:titles, naming, store)
81
+ @title ||= Translator.new(:title, naming, store)
82
82
  end
83
83
 
84
84
  # The description translation.
85
85
  def description(html: false)
86
86
  @description[html] ||= Translator.new(
87
- :descriptions,
87
+ :description,
88
88
  naming,
89
89
  store.merge(html:)
90
90
  )
@@ -13,31 +13,34 @@ module PageMeta
13
13
  @options = options
14
14
  end
15
15
 
16
- def singular_scope
17
- @singular_scope ||= if scope == :keywords
18
- "keywords"
19
- else
20
- scope.to_s.singularize
21
- end
22
- end
23
-
24
16
  def to_s
25
17
  return "" if simple.blank?
26
18
 
27
19
  value = simple
28
20
 
29
21
  [
30
- t("page_meta.#{scope}.base", value:, **override_options),
31
- t("page_meta.#{singular_scope}_base", value:, **override_options,
32
- default: value)
22
+ # Set base scope for controller
23
+ t(
24
+ "page_meta.#{naming.controller}.#{scope}_base",
25
+ value:,
26
+ **override_options
27
+ ),
28
+
29
+ # Set base scope for action
30
+ t(
31
+ "page_meta.#{naming.controller}.#{naming.action}.#{scope}_base",
32
+ value:,
33
+ **override_options
34
+ ),
35
+
36
+ # Set base scope
37
+ t("page_meta.#{scope}_base", value:, **override_options,
38
+ default: value)
33
39
  ].reject(&:blank?).first || ""
34
40
  end
35
41
 
36
42
  def translation_scope
37
- [
38
- "page_meta.#{scope}.#{naming.controller}.#{naming.action}",
39
- "page_meta.#{naming.controller}.#{naming.action}.#{singular_scope}"
40
- ]
43
+ ["page_meta.#{naming.controller}.#{naming.action}.#{scope}"]
41
44
  end
42
45
 
43
46
  def override_options
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PageMeta
4
- VERSION = "2.0.0"
4
+ VERSION = "2.0.1"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: page_meta
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nando Vieira