lib/rocket_job/plugins/state_machine.rb in rocketjob-5.1.1 vs lib/rocket_job/plugins/state_machine.rb in rocketjob-5.2.0.beta1
- old
+ new
@@ -1,7 +1,7 @@
-require 'active_support/concern'
-require 'aasm'
+require "active_support/concern"
+require "aasm"
module RocketJob
module Plugins
# State machine for RocketJob
#
@@ -31,11 +31,11 @@
include AASM
# Adds a :before or :after callback to an event
# state_machine_add_event_callback(:start, :before, :my_method)
def self.state_machine_add_event_callback(event_name, action, *methods, &block)
- raise(ArgumentError, 'Cannot supply both a method name and a block') if methods.size.positive? && block
- raise(ArgumentError, 'Must supply either a method name or a block') unless methods.size.positive? || block
+ raise(ArgumentError, "Cannot supply both a method name and a block") if methods.size.positive? && block
+ raise(ArgumentError, "Must supply either a method name or a block") unless methods.size.positive? || block
# TODO: Somehow get AASM to support options such as :if and :unless to be consistent with other callbacks
# For example:
# before_start :my_callback, unless: :encrypted?
# before_start :my_callback, if: :encrypted?