spoonsix-ssm 0.1.7 → 0.1.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -3,9 +3,9 @@ module SSM
3
3
  module ActiveRecordStrategy
4
4
 
5
5
  def ssm_setup
6
+ _synchronize_state if new_record?
6
7
  end
7
8
 
8
-
9
9
  def ssm_set(v)
10
10
  send("#{@ssm_state_machine.property_name}=".to_sym, v)
11
11
  end
data/lib/ssm.rb CHANGED
@@ -136,7 +136,7 @@ module SSM
136
136
 
137
137
  # Sets the instance attribute that stores a representation of the State. In
138
138
  # the first form, the property will return a symbol represeting the State.
139
- # In the second form, an index is returned, making it more convenient when
139
+ # In the second form, an integer is returned, making it more convenient when
140
140
  # dealing with persistence.
141
141
  #
142
142
  # class Door
@@ -152,7 +152,7 @@ module SSM
152
152
  # class Door
153
153
  # include SSM
154
154
  #
155
- # ssm_inject_state_into :state, :use_index
155
+ # ssm_inject_state_into :state, :as_integer => true
156
156
  # ssm_initial_state :closed
157
157
  # end
158
158
  #
@@ -160,7 +160,7 @@ module SSM
160
160
  #
161
161
  def ssm_inject_state_into(name, options={}, &block)
162
162
  SSM::TemplateStateMachines[self].property_name = name
163
- SSM::TemplateStateMachines[self].use_property_index = options[:map_to_index].nil? ? false : true
163
+ SSM::TemplateStateMachines[self].use_property_index = options[:as_integer].nil? ? false : true
164
164
  SSM::TemplateStateMachines[self].injection_strategy = options[:strategy] #SSM::InjectionStrategies::Base.factory(options[:strategy])
165
165
  end
166
166
 
data/lib/state_machine.rb CHANGED
@@ -70,11 +70,11 @@ module SSM
70
70
  end
71
71
 
72
72
  def get_state_for_property
73
- @use_property_index == true ? get_state_index_by_name(@current_state.name) : @current_state.name
73
+ @use_property_index == true ? get_state_index_by_name(@current_state.name) : @current_state.name.to_s
74
74
  end
75
75
 
76
76
  def get_state_by_name(name)
77
- state = @states.find { |state| state.name == name}
77
+ state = @states.find { |state| state.name == name.to_sym}
78
78
  raise SSM::UndefinedState.new unless state.is_a?(SSM::State)
79
79
  state
80
80
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spoonsix-ssm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Luis Correa d'Almeida
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-07-13 00:00:00 -07:00
12
+ date: 2009-07-24 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies: []
15
15