stateology 0.1.0 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/stateology.rb +12 -3
  2. metadata +1 -1
data/lib/stateology.rb CHANGED
@@ -6,7 +6,6 @@ end
6
6
 
7
7
  require 'mixology'
8
8
 
9
-
10
9
  module Stateology
11
10
 
12
11
  # alternative to 'nil'
@@ -20,8 +19,17 @@ module Stateology
20
19
  # class methods
21
20
  module SM_Class_Methods
22
21
  def state(name, &block)
23
-
24
- const_set(name, Module.new(&block))
22
+ m = Module.new(&block)
23
+
24
+ if constants.include?(name.to_s) then
25
+ inherited_state = const_get(name)
26
+
27
+ # ignore if the constant is not a module
28
+ m.send(:include, inherited_state) if Module === inherited_state
29
+ end
30
+
31
+ const_set(name, m)
32
+
25
33
  end
26
34
  end
27
35
 
@@ -113,6 +121,7 @@ module Stateology
113
121
  end
114
122
 
115
123
  private :__state_prologue, :__state_epilogue
124
+
116
125
  end
117
126
 
118
127
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stateology
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Mair