gosu_extensions 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/traits/generator.rb +14 -10
- data/lib/traits/lives.rb +1 -1
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.6
|
data/lib/traits/generator.rb
CHANGED
@@ -17,8 +17,8 @@ module Generator
|
|
17
17
|
klass
|
18
18
|
end
|
19
19
|
class_eval <<-GENERATION
|
20
|
-
def start_generating every_rate = #{rate || 10}, til = #{til ||
|
21
|
-
return if til <= 0
|
20
|
+
def start_generating! every_rate = #{rate || 10}, til = #{til || false}, offset = #{offset || rate || 10}
|
21
|
+
return if til && til <= 0
|
22
22
|
threaded offset, &generation(generated_class, every_rate, til)
|
23
23
|
end
|
24
24
|
GENERATION
|
@@ -27,7 +27,7 @@ end
|
|
27
27
|
#
|
28
28
|
if offset
|
29
29
|
InitializerHooks.register self do
|
30
|
-
start_generating
|
30
|
+
start_generating!
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
@@ -37,17 +37,21 @@ end
|
|
37
37
|
|
38
38
|
module InstanceMethods
|
39
39
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
40
|
+
def destroy!
|
41
|
+
stop_generating!
|
42
|
+
super
|
43
|
+
end
|
44
|
+
|
45
|
+
def stop_generating!
|
46
|
+
@stop_generating = true
|
47
|
+
end
|
46
48
|
|
47
49
|
def generation klass, every_rate, til
|
50
|
+
return lambda {} if @stop_generating
|
48
51
|
lambda do
|
49
52
|
self.generate klass
|
50
|
-
|
53
|
+
til = til - every_rate if til
|
54
|
+
self.start_generating! every_rate, til, every_rate
|
51
55
|
end
|
52
56
|
end
|
53
57
|
|
data/lib/traits/lives.rb
CHANGED