ruby-immutable-struct 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ruby-immutable-struct.rb +4 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 902795d3b8d0fd5bf57528bc5f2e355749ad83b6
|
4
|
+
data.tar.gz: d8f594b5dc4e021b6ee031fa772f3dfb599e953b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 21c71edff4721c95b66951ebac3c0873164542158a2e01cbe1e04b35e3e34f6fe883759166166fd91508d45129333f5bd1a3a0903dc2a00625ad9191db03e060
|
7
|
+
data.tar.gz: 08a9b74ad512a5953902c49730d1437619d9a757d73991e80d9cb802c45de973de35940dad2c43f411b9c25d76739121f482c559eaa52a7882bff04c5542e72c
|
@@ -11,7 +11,10 @@ module RubyImmutableStruct
|
|
11
11
|
|
12
12
|
class_eval <<-EOT
|
13
13
|
def initialize(*args)
|
14
|
-
|
14
|
+
# args.length == 1 is faster than args[0].is_a?(Hash). So check it
|
15
|
+
# first -- speed demons won't be using hashes, so let's save them the
|
16
|
+
# is_a? call.
|
17
|
+
if args.length == 1 && args[0].is_a?(Hash)
|
15
18
|
hash = args[0]
|
16
19
|
#{attributes.map{ |a| "@#{a} = hash[:#{a}]" }.join(';')}
|
17
20
|
else
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-immutable-struct
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Hooper
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-07-
|
11
|
+
date: 2016-07-16 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email: adam@adamhooper.com
|