myrrha 3.0.0.rc2 → 3.0.0.rc3

Sign up to get free protection for your applications and to get access to all the features.
@@ -13,10 +13,17 @@ module Domain
13
13
  domain_error!(arg)
14
14
  end
15
15
 
16
- def [](first, *args)
17
- args.empty? ? coerce(first) : coerce(args.unshift(first))
16
+ def [](first = NOT_PROVIDED, *args)
17
+ if first == NOT_PROVIDED
18
+ coerce([])
19
+ elsif args.empty?
20
+ coerce(first)
21
+ else
22
+ coerce(args.unshift(first))
23
+ end
18
24
  end
19
25
 
26
+ NOT_PROVIDED = Object.new
20
27
  end # module CoercionMethods
21
28
  include CoercionMethods
22
29
  end # module Domain
@@ -3,7 +3,7 @@ module Myrrha
3
3
 
4
4
  MAJOR = 3
5
5
  MINOR = 0
6
- TINY = "0.rc2"
6
+ TINY = "0.rc3"
7
7
 
8
8
  def self.to_s
9
9
  [ MAJOR, MINOR, TINY ].join('.')
data/myrrha.noespec CHANGED
@@ -10,7 +10,7 @@ variables:
10
10
  upper:
11
11
  Myrrha
12
12
  version:
13
- 3.0.0.rc2
13
+ 3.0.0.rc3
14
14
  summary: |-
15
15
  Myrrha provides the coercion framework which is missing to Ruby.
16
16
  description: |-
@@ -7,8 +7,8 @@ describe Domain, "coerce" do
7
7
 
8
8
  before do
9
9
  domain.coercions do |c|
10
- c.coercion(String){|v,_| expected }
11
- c.coercion(Array) {|v,_| domain.new(*v) }
10
+ c.coercion(String){|v,_| expected }
11
+ c.coercion(Array) {|v,_| expected }
12
12
  end
13
13
  end
14
14
 
@@ -29,7 +29,11 @@ describe Domain, "coerce" do
29
29
  end
30
30
 
31
31
  it 'supports Array literals' do
32
- domain[1, 3].should eq(domain.new(1, 3))
32
+ domain[1, 3].should eq(expected)
33
+ end
34
+
35
+ it 'supports empty Array literals' do
36
+ domain[].should eq(expected)
33
37
  end
34
38
  end
35
39
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: myrrha
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0.rc2
4
+ version: 3.0.0.rc3
5
5
  prerelease: 6
6
6
  platform: ruby
7
7
  authors: