Merge pull request #51 from ernie/intialize-copy

Use Ruby's initialize_copy for clone/dup
This commit is contained in:
Thorsten Böttger 2012-06-28 03:50:50 -07:00
commit 21394075f2
1 changed files with 6 additions and 7 deletions

View File

@ -3,11 +3,11 @@ module AASM
def self.[](clazz)
(@machines ||= {})[clazz.to_s]
end
def self.[]=(clazz, machine)
(@machines ||= {})[clazz.to_s] = machine
end
attr_accessor :states, :events, :initial_state, :config
attr_reader :name
@ -19,11 +19,10 @@ module AASM
@config = OpenStruct.new
end
def clone
klone = super
klone.states = states.clone
klone.events = events.clone
klone
def initialize_copy(orig)
super
@states = @states.dup
@events = @events.dup
end
def create_state(name, options)