frozen_record 0.19.1 → 0.19.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d75dfc07a86429e4dcc6a17c076aa87081a19e812b3d9b8d9722281d8a14aba9
4
- data.tar.gz: a445c878d8cddaa87cb59db1213cf4099e3cbf10fa854d92fbd28669867dad4a
3
+ metadata.gz: 501a982beb96747b9e2dfd6250e9685e73ffbb2932cb5fddb84b7b44f778c3dd
4
+ data.tar.gz: 9396c1416991e6a932d8a16fa430471c531281be58e8547af8a1900ebf68d4cc
5
5
  SHA512:
6
- metadata.gz: 54b3c787e7c0f028c8c58a2a1fb214a5b3ac0c4b8b06ac4a42d4a35526baa0c50573967a7aa7faad0921c028d19d985dda831257f2244b1ba5af56960187ced1
7
- data.tar.gz: 8159f7e45d32256ab9565bbf5ff81c6685e912c57603f97b335f8c5dbb2529b4153bb0e2937e4c709da9a78d0f303f485e33daf4933aa129be9599313964ec8d
6
+ metadata.gz: be0b8317169536a900a01769866f5b7b181974ed24dfd812abcfbd5b332324da1d8d9870c80c89af50bb3fa1565342a5e1229b198b8b6fc141d93c237566a152
7
+ data.tar.gz: 3a4c490e06150033c098905817842e6c2cc9b2719262f28f53e063de34815236910e18da5cf3e9848f4aed1e1db2e738d2b33dcce90f429fa1cdba2840cf4556
@@ -21,7 +21,8 @@ module FrozenRecord
21
21
  FALSY_VALUES = [false, nil, 0, -''].to_set
22
22
 
23
23
  class_attribute :base_path, :primary_key, :backend, :auto_reloading, :default_attributes, instance_accessor: false
24
- class_attribute :index_definitions, instance_accessor: false, default: {}.freeze
24
+ class_attribute :index_definitions, instance_accessor: false
25
+ self.index_definitions = {}.freeze
25
26
 
26
27
  self.primary_key = 'id'
27
28
 
@@ -67,7 +67,7 @@ module FrozenRecord
67
67
  end
68
68
 
69
69
  def build(records)
70
- @index = records.to_h { |r| [r[attribute], r] }
70
+ @index = records.each_with_object({}) { |r, index| index[r[attribute]] = r }
71
71
  if @index.size != records.size
72
72
  raise AttributeNonUnique, "#{model}##{attribute.inspect} is not unique."
73
73
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module FrozenRecord
4
- VERSION = '0.19.1'
4
+ VERSION = '0.19.2'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: frozen_record
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.19.1
4
+ version: 0.19.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jean Boussier
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-07-16 00:00:00.000000000 Z
11
+ date: 2020-08-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel
@@ -156,7 +156,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
156
156
  - !ruby/object:Gem::Version
157
157
  version: '0'
158
158
  requirements: []
159
- rubygems_version: 3.1.2
159
+ rubygems_version: 3.0.2
160
160
  signing_key:
161
161
  specification_version: 4
162
162
  summary: ActiveRecord like interface to read only access and query static YAML files