restarts 1.0.2 → 1.0.3

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/restarts.rb +7 -6
  2. metadata +2 -2
data/lib/restarts.rb CHANGED
@@ -4,7 +4,7 @@
4
4
  # Refer to README.txt for more info
5
5
 
6
6
  module Restarts
7
- VERSION = '1.0.2'
7
+ VERSION = '1.0.3'
8
8
  end
9
9
 
10
10
  module Kernel
@@ -18,12 +18,13 @@ module Kernel
18
18
  restart = callcc do |cc|
19
19
  # Have the continuation object accessible via the #restart method.
20
20
  # FIXME: check for pre defined methods by the name "restart".
21
- (class <<condition; self; end).class_eval do
22
- define_method(:restart) do |*id|
23
- if id.empty?
24
- return cc
21
+ condition.instance_variable_set(:@cc, cc)
22
+ condition.instance_eval do
23
+ def restart(id=nil)
24
+ if id.nil?
25
+ return @cc
25
26
  else
26
- return cc.call(id[0])
27
+ return @cc.call(id)
27
28
  end
28
29
  end
29
30
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: restarts
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Archit Baweja
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-08-22 00:00:00 +05:30
12
+ date: 2008-08-25 00:00:00 +05:30
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency