state_machines 0.100.0 → 0.100.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: c2e1765c263d1be7747cf812e195b95ab82d183dbf62d83a4014bc47e34132ee
4
- data.tar.gz: 35fc3eba5b2a7321436de83091467b0f9e65309356e7d948479acd46be85ee68
3
+ metadata.gz: a87715920a8f37a43cbac61b18e9a1c91d72b4b2d2228c3dc275dc05781efe9f
4
+ data.tar.gz: 7e098b96739caf0b91010ae21c626109b58fbd7325bfa309c0518055e040bcbb
5
5
  SHA512:
6
- metadata.gz: 7b76d0c6596909901ccbeedf46b581b0fda2289466ae9c0bd402dc8b40db7d39fe74cbe7792a3b49c439e920ac6dd92c6bedfb51236155a3d0e61b0d7a84db51
7
- data.tar.gz: 887b286630bd17fb51c9b00550ee3c6822fd3d1b0c2084630d4cf3e960c66abda12962e050bd09c1829e7091694d120378ad15607ba02f1f2594518b15173976
6
+ metadata.gz: 7c4905db4ba8245378cb89118143432d0fd009cefbef97846bbd12608c2dbb8b55627dceb71c2a044933acb3aeae4d57c21aa16c687b32883e18789b207da088
7
+ data.tar.gz: 3031f999997380d3def3b379ef794639463a2b0c82913e08f8829374fe5707ea36076e999965719db4dadcd31f8c9890fd40ff4bf6db9a3b2d081d99a771efe5
@@ -33,6 +33,12 @@ module StateMachines
33
33
  def matches_ancestors?(ancestors)
34
34
  (ancestors & matching_ancestors).any?
35
35
  end
36
+
37
+ # Additional options that this integration adds to the state machine.
38
+ # Integrations can override this method to specify additional valid options.
39
+ def integration_options
40
+ []
41
+ end
36
42
  end
37
43
 
38
44
  def self.included(base) # :nodoc:
@@ -6,14 +6,18 @@ module StateMachines
6
6
  # Initializes a new state machine with the given configuration.
7
7
  def initialize(owner_class, *args, &)
8
8
  options = args.last.is_a?(Hash) ? args.pop : {}
9
- StateMachines::OptionsValidator.assert_valid_keys!(options, :attribute, :initial, :initialize, :action, :plural, :namespace, :integration, :messages, :use_transactions, :async)
10
-
9
+
11
10
  # Find an integration that matches this machine's owner class
12
11
  @integration = if options.include?(:integration)
13
12
  options[:integration] && StateMachines::Integrations.find_by_name(options[:integration])
14
13
  else
15
14
  StateMachines::Integrations.match(owner_class)
16
15
  end
16
+
17
+ # Validate options including integration-specific options
18
+ valid_keys = [:attribute, :initial, :initialize, :action, :plural, :namespace, :integration, :messages, :use_transactions, :async]
19
+ valid_keys += @integration.integration_options if @integration
20
+ StateMachines::OptionsValidator.assert_valid_keys!(options, valid_keys)
17
21
 
18
22
  if @integration
19
23
  extend @integration
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module StateMachines
4
- VERSION = '0.100.0'
4
+ VERSION = '0.100.1'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: state_machines
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.100.0
4
+ version: 0.100.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Abdelkader Boudih
@@ -135,7 +135,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
135
135
  - !ruby/object:Gem::Version
136
136
  version: '0'
137
137
  requirements: []
138
- rubygems_version: 3.6.9
138
+ rubygems_version: 3.6.7
139
139
  specification_version: 4
140
140
  summary: State machines for attributes
141
141
  test_files: []