value 1.1.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -41,7 +41,14 @@ module Value
41
41
  def inspect
42
42
  '%s.new(%s)' %
43
43
  [self.class,
44
- values.map{ |value| send(value).inspect }.join(', ')]
44
+ [values.required.map{ |name| send(name).inspect },
45
+ values.optional.
46
+ map{ |name, default| [send(name), default] }.
47
+ select{ |value, default| value != default or values.splat }.
48
+ map{ |value, _| value },
49
+ values.splat ? send(values.splat).map{ |value| value.inspect } : [],
50
+ values.block ? ['&%s' % [send(values.block).inspect]] : []].
51
+ flatten.join(', ')]
45
52
  end
46
53
 
47
54
  load File.expand_path('../value/version.rb', __FILE__)
@@ -3,7 +3,7 @@
3
3
  require 'inventory-1.0'
4
4
 
5
5
  module Value
6
- Version = Inventory.new(1, 1, 0){
6
+ Version = Inventory.new(1, 1, 1){
7
7
  def dependencies
8
8
  super + Inventory::Dependencies.new{
9
9
  development 'inventory-rake', 1, 2, 0
@@ -168,6 +168,26 @@ Expectations do
168
168
  Class.new{ Value(:a, :b, :c) }.new(1, 2, 3).inspect
169
169
  end
170
170
 
171
+ expect(/\A#<Class:0x[[:xdigit:]]+>\.new\(1, 2\)\z/) do
172
+ Class.new{ Value(:a, :b, [:c, 1]) }.new(1, 2, 1).inspect
173
+ end
174
+
175
+ expect(/\A#<Class:0x[[:xdigit:]]+>\.new\(1, 2, 3, 4, 5\)\z/) do
176
+ Class.new{ Value(:a, :b, :'*c') }.new(1, 2, 3, 4, 5).inspect
177
+ end
178
+
179
+ expect(/\A#<Class:0x[[:xdigit:]]+>\.new\(1, 2, 3, 4, 5\)\z/) do
180
+ Class.new{ Value(:a, :b, [:c, 1], :'*d') }.new(1, 2, 3, 4, 5).inspect
181
+ end
182
+
183
+ expect(/\A#<Class:0x[[:xdigit:]]+>\.new\(1, 2, 1, 4, 5\)\z/) do
184
+ Class.new{ Value(:a, :b, [:c, 1], :'*d') }.new(1, 2, 1, 4, 5).inspect
185
+ end
186
+
187
+ expect(/\A#<Class:0x[[:xdigit:]]+>\.new\(1, 2, 1, 4, 5, &#<Proc.*>\)\z/) do
188
+ Class.new{ Value(:a, :b, [:c, 1], :'*d', :'&e') }.new(1, 2, 1, 4, 5){ }.inspect
189
+ end
190
+
171
191
  expect 1 do
172
192
  Class.new{ include Module.new{ Value(:a) } }.new(1).instance_eval{ a }
173
193
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: value
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,22 +9,22 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-04-26 00:00:00.000000000 Z
12
+ date: 2012-05-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: inventory
16
- requirement: &15789612 !ruby/object:Gem::Requirement
16
+ requirement: &16034964 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
20
20
  - !ruby/object:Gem::Version
21
- version: '1.2'
21
+ version: '1.3'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *15789612
24
+ version_requirements: *16034964
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: inventory-rake
27
- requirement: &15788556 !ruby/object:Gem::Requirement
27
+ requirement: &16034472 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '1.2'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *15788556
35
+ version_requirements: *16034472
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: lookout
38
- requirement: &15787416 !ruby/object:Gem::Requirement
38
+ requirement: &16034004 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '3.0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *15787416
46
+ version_requirements: *16034004
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: lookout-rake
49
- requirement: &15786384 !ruby/object:Gem::Requirement
49
+ requirement: &16049868 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '3.0'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *15786384
57
+ version_requirements: *16049868
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: yard
60
- requirement: &15785652 !ruby/object:Gem::Requirement
60
+ requirement: &16049400 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ~>
@@ -65,7 +65,7 @@ dependencies:
65
65
  version: 0.7.0
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *15785652
68
+ version_requirements: *16049400
69
69
  description: ! " Value\n\n Value is a library
70
70
  for defining value objects in Ruby.\n"
71
71
  email: now@bitwi.se