state_manager 0.2.9 → 0.2.10
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/state_manager/adapters/active_record.rb +3 -1
- data/lib/state_manager/resource.rb +5 -2
- data/state_manager.gemspec +1 -1
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.10
|
@@ -13,7 +13,9 @@ module StateManager
|
|
13
13
|
module ResourceMethods
|
14
14
|
|
15
15
|
def self.included(base)
|
16
|
-
|
16
|
+
base.after_initialize do
|
17
|
+
self.state_managers ||= {}
|
18
|
+
end
|
17
19
|
base.before_validation do
|
18
20
|
validate_states!
|
19
21
|
end
|
@@ -52,7 +52,6 @@ module StateManager
|
|
52
52
|
state_managers[property] = klass
|
53
53
|
property_name = "#{property.to_s}_manager"
|
54
54
|
define_method property_name do
|
55
|
-
self.state_managers ||= {}
|
56
55
|
state_manager = state_managers[property]
|
57
56
|
unless state_manager
|
58
57
|
state_manager = klass.new(self)
|
@@ -66,9 +65,13 @@ module StateManager
|
|
66
65
|
end
|
67
66
|
|
68
67
|
module InstanceMethods
|
68
|
+
def initialize(*args)
|
69
|
+
super(*args)
|
70
|
+
self.state_managers ||= {}
|
71
|
+
end
|
72
|
+
|
69
73
|
# Ensures that all properties with state managers are in valid states
|
70
74
|
def validate_states!
|
71
|
-
self.state_managers ||= {}
|
72
75
|
self.class.state_managers.each do |name, klass|
|
73
76
|
# Simply ensuring that all of the state managers have been
|
74
77
|
# instantiated will make the corresponding states valid
|
data/state_manager.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: state_manager
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.10
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -271,7 +271,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
271
271
|
version: '0'
|
272
272
|
segments:
|
273
273
|
- 0
|
274
|
-
hash:
|
274
|
+
hash: -1972430724111836425
|
275
275
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
276
276
|
none: false
|
277
277
|
requirements:
|