lib/simplestate/state_holder.rb in simplestate-1.0.1 vs lib/simplestate/state_holder.rb in simplestate-1.0.2

- old
+ new

@@ -1,12 +1,12 @@ class StateHolder < SimpleDelegator - attr_reader :state_history, :beginning + attr_reader :beginning, :state_history attr_accessor :hx_size_limit def initialize(opts={}) - @state_history = [] - @hx_size_limit = opts.fetch :hx_size_limit, 5 @beginning = initial_state_class(opts) + @hx_size_limit = opts.fetch :hx_size_limit, 5 + @state_history = [] super(NilState.new(nil)) transition_to beginning end def transition_to(new_state_class) @@ -35,8 +35,8 @@ end def initial_state_class(opts) isc = opts.fetch :start_in, (opts.fetch :initial_state_class, nil) - isc ? isc : raise(NoMethodError) + isc ? isc : raise(ArgumentError, "initial state class is missing.") end end