immutable_struct 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/immutable_struct.rb +2 -2
- metadata +3 -3
data/lib/immutable_struct.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
3
|
class ImmutableStruct
|
4
|
-
VERSION = '1.1.
|
4
|
+
VERSION = '1.1.1'
|
5
5
|
|
6
6
|
def self.new(*attrs, &block)
|
7
7
|
struct = Struct.new(*attrs, &block)
|
@@ -25,7 +25,7 @@ private
|
|
25
25
|
alias_method :struct_initialize, :initialize
|
26
26
|
|
27
27
|
def initialize(*attrs)
|
28
|
-
if attrs && attrs.size == 1 && attrs.first.
|
28
|
+
if members.size > 1 && attrs && attrs.size == 1 && attrs.first.instance_of?(Hash)
|
29
29
|
struct_initialize(*members.map { |m| attrs.first[m.to_sym] })
|
30
30
|
else
|
31
31
|
struct_initialize(*attrs)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: immutable_struct
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2013-05-20 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rspec
|
@@ -71,7 +71,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
71
71
|
version: '0'
|
72
72
|
segments:
|
73
73
|
- 0
|
74
|
-
hash:
|
74
|
+
hash: 186220760556065832
|
75
75
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
76
76
|
none: false
|
77
77
|
requirements:
|