key_struct 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -19,7 +19,7 @@ module KeyStruct
19
19
  def self.define_key_struct(access, keys)
20
20
  klass = Class.new
21
21
  klass.class_eval do
22
- keyvalues = Hash[*keys.map{|key| (Hash === key) ? key.to_a : [key, nil]}.flatten]
22
+ keyvalues = Hash[*keys.map{|key| (Hash === key) ? key.to_a : [key, nil]}.flatten(2)]
23
23
  keys = keyvalues.keys
24
24
  send access, *keys
25
25
  define_method(:initialize) do |args={}|
@@ -1,3 +1,3 @@
1
1
  module KeyStruct
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
@@ -14,6 +14,10 @@ describe "KeyStruct" do
14
14
  Class.should === KeyStruct[:a, :b, :c => 3]
15
15
  end
16
16
 
17
+ it "can handle a default that's an array" do
18
+ expect { KeyStruct.reader(:a => []) }.should_not raise_error
19
+ end
20
+
17
21
  it "[] should be an alias for accessor" do
18
22
  KeyStruct.method(:[]).should == KeyStruct.method(:accessor)
19
23
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: key_struct
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-11-21 00:00:00.000000000 Z
12
+ date: 2011-11-27 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
16
- requirement: &70365334363320 !ruby/object:Gem::Requirement
16
+ requirement: &70343126940120 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *70365334363320
24
+ version_requirements: *70343126940120
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: simplecov
27
- requirement: &70365334361480 !ruby/object:Gem::Requirement
27
+ requirement: &70343126939660 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *70365334361480
35
+ version_requirements: *70343126939660
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: simplecov-gem-adapter
38
- requirement: &70365334359460 !ruby/object:Gem::Requirement
38
+ requirement: &70343126939240 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,7 +43,7 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *70365334359460
46
+ version_requirements: *70343126939240
47
47
  description: Defines KeyStruct analogous to Struct, but constructor takes keyword
48
48
  arguments
49
49
  email:
@@ -84,7 +84,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
84
84
  version: '0'
85
85
  requirements: []
86
86
  rubyforge_project:
87
- rubygems_version: 1.8.10
87
+ rubygems_version: 1.8.6
88
88
  signing_key:
89
89
  specification_version: 3
90
90
  summary: Defines KeyStruct analogous to Struct, but constructor takes keyword arguments