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 CHANGED
@@ -1 +1 @@
1
- 0.1.5
1
+ 0.1.6
@@ -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 || 100}, offset = #{offset || 0}
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
- # See in #generates.
41
- #
42
- # def start_generating every_rate, til, offset, klass
43
- # return if til <= 0
44
- # threaded offset, &generation(klass, every_rate, til)
45
- # end
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
- self.start_generating every_rate, til - every_rate, every_rate
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
@@ -50,7 +50,7 @@ module Lives
50
50
  end
51
51
  def kill!
52
52
  self.lives -= 1
53
- killed!
53
+ killed! if self.lives > 0
54
54
  destroy! if self.lives == 0
55
55
  end
56
56
 
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 5
9
- version: 0.1.5
8
+ - 6
9
+ version: 0.1.6
10
10
  platform: ruby
11
11
  authors:
12
12
  - Florian Hanke