spoonsix-ssm 0.1.6 → 0.1.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,19 @@
1
+ module SSM
2
+ module InjectionStrategies
3
+ module ActiveRecordStrategy
4
+
5
+ def ssm_setup
6
+ end
7
+
8
+
9
+ def ssm_set(v)
10
+ send("#{@ssm_state_machine.property_name}=".to_sym, v)
11
+ end
12
+
13
+ def ssm_get
14
+ send("#{@ssm_state_machine.property_name}".to_sym)
15
+ end
16
+
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,6 @@
1
+ module SSM
2
+ module InjectionStrategies
3
+ class Base
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,28 @@
1
+ module SSM
2
+ module InjectionStrategies
3
+ module ObjectStrategy
4
+
5
+ # Generic setup
6
+ def ssm_setup
7
+ sm = @ssm_state_machine
8
+ unless sm.property_name.nil?
9
+ # This allows others to set up the object however they see fit, including mixing in setters.
10
+ instance_eval("def #{sm.property_name}; @#{sm.property_name}; end") unless respond_to?(sm.property_name)
11
+ instance_eval("def #{sm.property_name}=(v); @#{sm.property_name} = v; end") unless respond_to?("#{sm.property_name}=".to_sym)
12
+
13
+ _synchronize_state
14
+ end
15
+ end
16
+
17
+
18
+ def ssm_set(v)
19
+ send("#{@ssm_state_machine.property_name}=".to_sym, v)
20
+ end
21
+
22
+ def ssm_get
23
+ send("#{@ssm_state_machine.property_name}".to_sym)
24
+ end
25
+
26
+ end
27
+ end
28
+ end
data/lib/ssm.rb CHANGED
@@ -41,7 +41,7 @@ require File.join(File.dirname(__FILE__), 'injection_strategies', 'base')
41
41
  #--
42
42
  module SSM
43
43
 
44
- VERSION = '0.1.6';
44
+ VERSION = '0.1.7';
45
45
 
46
46
  class InvalidTransition < RuntimeError; end
47
47
  class UndefinedState < RuntimeError; 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.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Luis Correa d'Almeida
@@ -27,6 +27,9 @@ files:
27
27
  - lib/state.rb
28
28
  - lib/state_machine.rb
29
29
  - lib/state_transition.rb
30
+ - lib/injection_strategies/base.rb
31
+ - lib/injection_strategies/object_strategy.rb
32
+ - lib/injection_strategies/active_record_strategy.rb
30
33
  has_rdoc: false
31
34
  homepage: http://github.com/spoonsix/ssm
32
35
  post_install_message: