site_prism 6.0 → 6.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: 0b74cd59603d8fff11657b6d51ccfe37bddf78004ab4b55bb692f11a54754fc4
4
- data.tar.gz: 618953ce4d7c07d4cac6ed0ed6dbc54b4e1dbd835cf28e39b6488dfb7c8d8698
3
+ metadata.gz: cbf69e354e41352b4e8b03aa44073b0b4f6b1d77edbfe8be80c670aac96f2b81
4
+ data.tar.gz: 680daa2c693b77fe00c0e7ce1b3eeda648a9c088cefa7b6fbf2bb6783d5b57a4
5
5
  SHA512:
6
- metadata.gz: 8a7bd17d94fd99d4772e94df111312047fc644a21f80a6d8343a8167a4e84529692e8a0e6048232f54320961fa451ae670e746eca0df5854cb6bf7139e0fa94b
7
- data.tar.gz: 53c0d351c47adefab78baf703f5e571dbc03914cc69c6906e52dd8bf7761fc246dbd0693f6b77e710a2c058e6c244813868190644154d0b8174238eaf9aaa38b
6
+ metadata.gz: 1b963f301fbc93813259dfa275e02b60ed9ca49aea6765f86b5117a06cd9063c6f7cd2380a1b80c3e975de5f22869d315e7ed6b0a3973aae91ec66bfaa74f48e
7
+ data.tar.gz: a7f9fda146472e1ae262ed5078108bb1080ac085115e703a310b2a259d448449a2cc567e8809836beb3501d25bcffbc4fd80e38275127e916610794a97516214
@@ -102,7 +102,11 @@ module SitePrism
102
102
  end
103
103
 
104
104
  def slugs
105
- pattern.scan(/{[^}]+}/)
105
+ if RUBY_VERSION >= '3.2'
106
+ pattern.scan(Regexp.new('{[^}]+}', timeout: 5))
107
+ else
108
+ pattern.scan(/{[^}]+}/)
109
+ end
106
110
  end
107
111
 
108
112
  def all_expected_mappings_match?(expected_mappings, actual_mappings)
@@ -23,11 +23,11 @@ module SitePrism
23
23
  #
24
24
  # NB: This will only trigger load validations if the page is already **not** loaded. If you want to verbosely trigger
25
25
  # the load validations irrespective, use `#run_load_validations`; which will clear any previous cache and then re-run the validations
26
- def when_loaded
27
- # Get original loaded value, in case we are nested
28
- # inside another when_loaded block.
29
- previously_loaded = loaded
30
-
26
+ #
27
+ # @param previously_loaded [Boolean, nil]
28
+ # Original loaded value (which may be nil), in case we are nested inside another `#when_loaded` block or called
29
+ # prior to the `#run_load_validations` invocation
30
+ def when_loaded(previously_loaded = loaded)
31
31
  # Within the block, check (and cache) loaded?, to see whether the page has indeed loaded according to the rules defined by the user.
32
32
  self.loaded = loaded?
33
33
 
@@ -38,7 +38,8 @@ module SitePrism
38
38
  # Return the yield value of the block if one was supplied.
39
39
  yield self if block_given?
40
40
  ensure
41
- self.loaded = previously_loaded
41
+ # Restore the previous loaded state only if validations passed (i.e., loaded? was true).
42
+ self.loaded = previously_loaded if loaded
42
43
  end
43
44
 
44
45
  # Check if the page is loaded.
@@ -56,16 +57,18 @@ module SitePrism
56
57
  load_validations_pass?
57
58
  end
58
59
 
59
- # Executes the `when_loaded` check to determine if the page is loaded, but also clears any previous cache
60
- # of the loaded state and load error
60
+ # Executes the `#when_loaded` check to determine if the page is loaded, but also temporarily clears any previously cached
61
+ # loaded state / load error(s), to ensure load validations are re-ran fully
61
62
  #
62
63
  # This is useful if you want to re-run the load validations irrespective of whether the page was previously loaded or not
63
64
  #
64
65
  # The loadable object instance is yielded into the block.
65
- def run_load_validations
66
+ def run_load_validations(&)
67
+ previously_loaded = loaded
68
+
66
69
  self.loaded = false
67
70
  self.load_error = nil
68
- when_loaded
71
+ when_loaded(previously_loaded, &)
69
72
  end
70
73
 
71
74
  private
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SitePrism
4
- VERSION = '6.0'
4
+ VERSION = '6.0.1'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: site_prism
3
3
  version: !ruby/object:Gem::Version
4
- version: '6.0'
4
+ version: 6.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Luke Hill
@@ -151,14 +151,14 @@ dependencies:
151
151
  requirements:
152
152
  - - "~>"
153
153
  - !ruby/object:Gem::Version
154
- version: 1.85.1
154
+ version: 1.88.0
155
155
  type: :development
156
156
  prerelease: false
157
157
  version_requirements: !ruby/object:Gem::Requirement
158
158
  requirements:
159
159
  - - "~>"
160
160
  - !ruby/object:Gem::Version
161
- version: 1.85.1
161
+ version: 1.88.0
162
162
  - !ruby/object:Gem::Dependency
163
163
  name: rubocop-performance
164
164
  requirement: !ruby/object:Gem::Requirement