state_machines 0.305.0 → 0.306.0

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: '0786cd064b1c8a4d4059cf25f0626596722957a07e14b49b8410ee3e89004339'
4
- data.tar.gz: b767aa9e33559e58d2c1f396d0b37eabf7eda95f5c9a230af4994785a4316fa2
3
+ metadata.gz: a4e9546f230db48a9895e84f10f8f8ea71bb5934864adc72fa97a466af5e3af3
4
+ data.tar.gz: 163c6d689b435eb01bf137de5c866db39fe1f9061bd5fa77f05d3e019cf450cb
5
5
  SHA512:
6
- metadata.gz: 8b2d9d7a22a0831c1d5db45efcc695b759dd2a50cf3c98ac06bcabacb32b3730405d2113c2c3a0aedfb832c17fa330ceeae77a39fa13977cdbb4eb913204b76a
7
- data.tar.gz: 748b596b642049249be0e6a3aa13ad160becec9d1ea72b962bc83ffc300d91a287cff5aa20f0eee2cbfec961097900da4e0fe620e97db529b58dbacff4e61aff
6
+ metadata.gz: 65fa1768e9543d26d65993624230fb8e7ac5040073ca7df7ed561613152856b796271a42fb7cd31e7c0165ea2a8b2bc336788bbcdbdf8aa7e64295975df1ddb9
7
+ data.tar.gz: 53a3fd1ad1de916e997502cca89537a239d7a7e93461938bab9a85860bb2803b81187ca8c006cfe23d724088d036240955595e59d1d774c9554ab3833854f055
@@ -80,6 +80,16 @@ module StateMachines
80
80
  check_conflicting_attribute_default
81
81
  end
82
82
 
83
+ # Whether a state predicate's conflict with a method the owner class
84
+ # already defines is expected, such as a Rails enum's. Returning true
85
+ # only silences the warning: the predicate is still not defined.
86
+ #
87
+ # @param _method [String] the predicate's name, such as "parked?"
88
+ # @return [Boolean]
89
+ def ignore_method_conflict?(_method)
90
+ false
91
+ end
92
+
83
93
  private
84
94
 
85
95
  # Gets the default messages that can be used in the machine for invalid
@@ -395,6 +395,10 @@ module StateMachines
395
395
  # understand this and what the consequences are, setting the
396
396
  # +ignore_method_conflicts+ option is a perfectly reasonable workaround.
397
397
  #
398
+ # An integration can silence only the predicate conflicts it expects by
399
+ # overriding +ignore_method_conflict?+. Those predicates are still not
400
+ # defined.
401
+ #
398
402
  # == Integrations
399
403
  #
400
404
  # By default, state machines are library-agnostic, meaning that they work
@@ -341,7 +341,7 @@ module StateMachines
341
341
  end
342
342
 
343
343
  def warn_about_method_conflict(method, defined_in)
344
- return if StateMachines::Machine.ignore_method_conflicts
344
+ return if StateMachines::Machine.ignore_method_conflicts || machine.send(:ignore_method_conflict?, method)
345
345
 
346
346
  warn machine.send(:method_conflict_message, :instance, method, defined_in)
347
347
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module StateMachines
4
- VERSION = '0.305.0'
4
+ VERSION = '0.306.0'
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.305.0
4
+ version: 0.306.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Abdelkader Boudih