spoonsix-ssm 0.1.6 → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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,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
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.
|
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:
|