anaphoric_case 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,3 @@
1
1
  module AnaphoricCase
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -59,11 +59,10 @@ module Kernel
59
59
  # @return [Object, FalseClase] the results of the first call to +on+ that returned
60
60
  # anything truthy, or of its block
61
61
  def switch object = nil, &block
62
- block = block.dup # enable cross thread sharing of blocks
63
-
64
62
  AnaphoricCase.__nest += 1
65
63
 
66
64
  raise ArgumentError, "switch requires a block" unless block_given?
65
+ block = block.dup # enable cross thread sharing of blocks
67
66
 
68
67
  class << self
69
68
  def on result = true, &block
@@ -163,6 +163,10 @@ describe "it is an anaphoric case" do
163
163
  res.should == "pizza"
164
164
  end
165
165
 
166
+ it "is an error to call it without a block" do
167
+ lambda { switch }.should raise_error ArgumentError, "switch requires a block"
168
+ end
169
+
166
170
  it "can't call on from outside of switch block" do
167
171
  lambda { on }.should raise_error NameError
168
172
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: anaphoric_case
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -14,7 +14,7 @@ default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rspec
17
- requirement: &4006280 !ruby/object:Gem::Requirement
17
+ requirement: &3997360 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ! '>='
@@ -22,10 +22,10 @@ dependencies:
22
22
  version: '0'
23
23
  type: :development
24
24
  prerelease: false
25
- version_requirements: *4006280
25
+ version_requirements: *3997360
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: simplecov
28
- requirement: &4006070 !ruby/object:Gem::Requirement
28
+ requirement: &3997150 !ruby/object:Gem::Requirement
29
29
  none: false
30
30
  requirements:
31
31
  - - ! '>='
@@ -33,10 +33,10 @@ dependencies:
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
- version_requirements: *4006070
36
+ version_requirements: *3997150
37
37
  - !ruby/object:Gem::Dependency
38
38
  name: rspec-prof
39
- requirement: &4005860 !ruby/object:Gem::Requirement
39
+ requirement: &3996940 !ruby/object:Gem::Requirement
40
40
  none: false
41
41
  requirements:
42
42
  - - ! '>='
@@ -44,10 +44,10 @@ dependencies:
44
44
  version: '0'
45
45
  type: :development
46
46
  prerelease: false
47
- version_requirements: *4005860
47
+ version_requirements: *3996940
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: i18n
50
- requirement: &4005650 !ruby/object:Gem::Requirement
50
+ requirement: &3996730 !ruby/object:Gem::Requirement
51
51
  none: false
52
52
  requirements:
53
53
  - - ! '>='
@@ -55,7 +55,7 @@ dependencies:
55
55
  version: '0'
56
56
  type: :development
57
57
  prerelease: false
58
- version_requirements: *4005650
58
+ version_requirements: *3996730
59
59
  description: ! "You have twenty or so methods, and you want to call the first one
60
60
  that returns something other than nil,\n If the dog is on fire, put it out."
61
61
  email: