seiten 1.3.0 → 1.3.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: 6289826464b8f2c34c78a4d469fe26e0e772c79f67adf29f38dc3465c9d35ed6
4
- data.tar.gz: fb131648fd8558fadf4e3b17f27aa1c24e4b4d4b59a13fcf0d173632c561c2a3
3
+ metadata.gz: 4fc7705a6877495b366341bd0d9c659e4db8c08da2110f5c168812d4ef1e1808
4
+ data.tar.gz: 689e0283f28c2ca9c7b9b9a2d5c8a5622a3fd08a84b4fc31c61ec78256c2cb6f
5
5
  SHA512:
6
- metadata.gz: b69aa165a103bd083dba0cb57c6c34078b139d56dba5a0e83679e4d654bd863e1e245d7dc247e429f6f3bf393818faa450f6c59fe9ad2255498e773427eb865c
7
- data.tar.gz: '0643406590aa1ae9a182222163f903764807699d460cfa9652f3a56e235685bbb4c50e440701cae5a519f1f0a2afb5c5ba680ea41d74bf9098257737bd39242b'
6
+ metadata.gz: 59e21842dd4be0f77765114a3ce92ae32d20e6cfcd323ef9584c2dc8ef3719b448008980cd3b0a79292474688ce8c8d32f700c15625049fc304e31636af06a64
7
+ data.tar.gz: 16859e5a224003e7c6c93371cf512e48efd132aa98c17f6c9170b814d963eaca6936d19b4b8f3622e27c4db5a2d541fdbf702fe040bf4b771346a977660382a1
@@ -23,15 +23,19 @@ module Seiten
23
23
  find_by(id: id)
24
24
  end
25
25
 
26
+ # Caches the pages it finds, not misses: a lookup by a slug from the URL would otherwise keep every
27
+ # unknown slug requested.
26
28
  def find_by(params)
27
29
  @find_by ||= {}
28
30
  return @find_by[params] if @find_by.key?(params)
29
31
 
30
- @find_by[params] = pages.find do |page|
32
+ found = pages.find do |page|
31
33
  params.all? do |k, v|
32
34
  page.send(k) == v
33
35
  end
34
36
  end
37
+ @find_by[params] = found if found
38
+ found
35
39
  end
36
40
 
37
41
  def where(params)
@@ -1,3 +1,3 @@
1
1
  module Seiten
2
- VERSION = "1.3.0"
2
+ VERSION = "1.3.1"
3
3
  end