Sha256: b8bd5d9253aef8d9d66f31d19d82ac861b858dcfc4e027e1110fa543f4bfc32b
Contents?: true
Size: 1.05 KB
Versions: 21
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
21 entries across 21 versions & 2 rubygems