lib/finite_machine/safety.rb in finite_machine-0.13.0 vs lib/finite_machine/safety.rb in finite_machine-0.14.0
- old
+ new
@@ -1,8 +1,8 @@
# frozen_string_literal: true
-require_relative 'hook_event'
+require_relative "hook_event"
module FiniteMachine
# Module responsible for safety checks against known methods
module Safety
EVENT_CONFLICT_MESSAGE = \
@@ -37,11 +37,11 @@
if method_already_implemented?(method_name)
raise FiniteMachine::AlreadyDefinedError, EVENT_CONFLICT_MESSAGE % {
name: event_name,
type: :instance,
method: method_name,
- source: 'FiniteMachine'
+ source: "FiniteMachine"
}
end
end
# Raise error when the callback name is not valid
@@ -87,12 +87,12 @@
# @return [Boolean]
#
# @api private
def wrong_event_name?(name, event_type)
machine.states.include?(name) &&
- !machine.events.include?(name) &&
- event_type < HookEvent::Anyaction
+ !machine.events.include?(name) &&
+ event_type < HookEvent::Anyaction
end
# Check if state name exists
#
# @param [Symbol] name
@@ -102,11 +102,11 @@
# @return [Boolean]
#
# @api private
def wrong_state_name?(name, event_type)
machine.events.include?(name) &&
- !machine.states.include?(name) &&
- event_type < HookEvent::Anystate
+ !machine.states.include?(name) &&
+ event_type < HookEvent::Anystate
end
def raise_invalid_callback_error(message)
exception = InvalidCallbackNameError
machine.catch_error(exception) || raise(exception, message)