Sha256: d7d4c150dcd7e3ac25cc4ffe262b86c755b7bb3ad635888300e4bceaa517f926
Contents?: true
Size: 1.05 KB
Versions: 61
Compression:
Stored size: 1.05 KB
Contents
module Ably::Modules # @api private module StatesmanMonkeyPatch # Override Statesman's #before_transition to support :from arrays # This can be removed once https://github.com/gocardless/statesman/issues/95 is solved def before_transition(options = nil, &block) arrayify_transition(options) do |options_without_from_array| super(*options_without_from_array, &block) end end # Override Statesman's #after_transition to support :from arrays # This can be removed once https://github.com/gocardless/statesman/issues/95 is solved def after_transition(options = nil, &block) arrayify_transition(options) do |options_without_from_array| super(*options_without_from_array, &block) end end private def arrayify_transition(options, &block) if options.nil? yield [] elsif options.fetch(:from, nil).kind_of?(Array) options[:from].each do |from_state| yield [options.merge(from: from_state)] end else yield [options] end end end end
Version data entries
61 entries across 61 versions & 2 rubygems