Sha256: d392f6a07b56b884e45c1d7be89c9a9795fee4d0695f49ed9eade98c89772044

Contents?: true

Size: 1.43 KB

Versions: 4

Compression:

Stored size: 1.43 KB

Contents

require 'aasm'

# The following patches can be removed once the following PR has been merged into AASM:
#   https://github.com/aasm/aasm/pull/269

AASM::Core::Event
module AASM::Core
  class Event
    def initialize_copy(orig)
      super
      @transitions = @transitions.collect { |transition| transition.clone }
      @guards      = @guards.dup
      @unless      = @unless.dup
      @options     = {}
      orig.options.each_pair { |name, setting| @options[name] = setting.is_a?(Hash) || setting.is_a?(Array) ? setting.dup : setting }
    end
  end
end

AASM::Core::State
module AASM::Core
  class State
    # called internally by Ruby 1.9 after clone()
    def initialize_copy(orig)
      super
      @options = {}
      orig.options.each_pair { |name, setting| @options[name] = setting.is_a?(Hash) || setting.is_a?(Array) ? setting.dup : setting }
    end
  end
end

AASM::Core::Transition
module AASM::Core
  class Transition
    def initialize_copy(orig)
      super
      @guards = @guards.dup
      @unless = @unless.dup
      @opts   = {}
      orig.opts.each_pair { |name, setting| @opts[name] = setting.is_a?(Hash) || setting.is_a?(Array) ? setting.dup : setting }
    end
  end
end

AASM::StateMachine
module AASM
  class StateMachine
    def initialize_copy(orig)
      super
      @states = orig.states.collect { |state| state.clone }
      @events = {}
      orig.events.each_pair { |name, event| @events[name] = event.clone }
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rocketjob-2.0.0 lib/rocket_job/extensions/aasm.rb
rocketjob-2.0.0.rc3 lib/rocket_job/extensions/aasm.rb
rocketjob-2.0.0.rc2 lib/rocket_job/extensions/aasm.rb
rocketjob-2.0.0.rc1 lib/rocket_job/extensions/aasm.rb