ruby-immutable-struct 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/ruby-immutable-struct.rb +4 -1
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7754c81e29ded23e8bd3cf9564802c0ad78009a2
4
- data.tar.gz: c4959dcf1b820d28faac4b143791b441787dca7f
3
+ metadata.gz: 902795d3b8d0fd5bf57528bc5f2e355749ad83b6
4
+ data.tar.gz: d8f594b5dc4e021b6ee031fa772f3dfb599e953b
5
5
  SHA512:
6
- metadata.gz: 21ec58ffd29d618e6a4f82f9a402606648eeb53b8a2870362237182c4363cb7c1d02d3e8a857a947835ec649046bf774396f92ba3e8fa8dfe84c35147b1bdeae
7
- data.tar.gz: 6d70901b359203958f8a85c26f4948bf0535ca2de69a17045cdd86fa880bbda7fdb13baacfb354846782c0399256d098366e376371e2a35438f8f93404f63a7c
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
- if args[0].is_a?(Hash)
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.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-08 00:00:00.000000000 Z
11
+ date: 2016-07-16 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email: adam@adamhooper.com