active_hash 1.5.0 → 1.5.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b8402bf0998ccf7ae1e02e14a7f8d751d223fb2f
4
- data.tar.gz: cebb5ad579c8330dd32de73c0c3e30b2ab9bb7a5
3
+ metadata.gz: 10ab92fe5ae0453d087ce9f904ade8c1664db5c3
4
+ data.tar.gz: '0964a0f76b8d9321f0c7bcbe136e2dde6a91ed2f'
5
5
  SHA512:
6
- metadata.gz: d4d6a5528d93310bb3d84ba38e92074df4a9717fd22b36ccf6133b6bd038ccd8a47b111d5e6c89255c64bbfb6cc86e000fc184a9d92880a41621a44ccb5d4218
7
- data.tar.gz: 294a765759e4310f83de96efcc43d670c099196e070a470483fd1123b9b52bca01fbf76b87a9a93fec746993e0470a4c00c54950f48d1576e68b735dc734b8f8
6
+ metadata.gz: c00058af1e0cc646f6f7e6b3e2b9a3f06e129c1297cd8d59dff7a9b7aff411beb91237bd4999976f8adfecce2244e85da9131332edee3b11eba665402380e40a
7
+ data.tar.gz: b41cd527f634cb8f57eea675ef2a732e97c808b9409086191b0b28391340d650d980d6b94aded02041856668c8dc5b9f2ae25d72f9b56c32720af599da9e0be0
data/CHANGELOG CHANGED
@@ -1,3 +1,6 @@
1
+ 2017-04-20 (v1.5.1)
2
+ - Fix a bug on `.where` [#147](https://github.com/zilkey/active_hash/pull/147)
3
+
1
4
  2017-03-24 (v1.5.0)
2
5
  - add support for `.find_by!`(@syguer)
3
6
 
@@ -90,7 +90,7 @@ module ActiveHash
90
90
 
91
91
  def insert(record)
92
92
  @records ||= []
93
- record.attributes[:id] ||= next_id
93
+ record[:id] ||= next_id
94
94
  validate_unique_id(record) if dirty
95
95
  mark_dirty
96
96
 
@@ -158,7 +158,8 @@ module ActiveHash
158
158
  return @records if options.blank?
159
159
 
160
160
  # use index if searching by id
161
- if (ids = (options.delete(:id) || options.delete("id")))
161
+ if options.key?(:id) || options.key?("id")
162
+ ids = (options.delete(:id) || options.delete("id"))
162
163
  candidates = Array.wrap(ids).map { |id| find_by_id(id) }
163
164
  end
164
165
  return candidates if options.blank?
@@ -319,7 +320,7 @@ module ActiveHash
319
320
  method_name = :"#{field}="
320
321
  unless instance_methods.include?(method_name)
321
322
  define_method(method_name) do |new_val|
322
- attributes[field] = new_val
323
+ @attributes[field] = new_val
323
324
  end
324
325
  end
325
326
  end
@@ -423,7 +424,7 @@ module ActiveHash
423
424
 
424
425
  def attributes
425
426
  if self.class.default_attributes
426
- self.class.default_attributes.merge @attributes
427
+ (self.class.default_attributes.merge @attributes).freeze
427
428
  else
428
429
  @attributes
429
430
  end
@@ -439,7 +440,7 @@ module ActiveHash
439
440
  alias_method :read_attribute, :_read_attribute
440
441
 
441
442
  def []=(key, val)
442
- attributes[key] = val
443
+ @attributes[key] = val
443
444
  end
444
445
 
445
446
  def id
@@ -447,7 +448,7 @@ module ActiveHash
447
448
  end
448
449
 
449
450
  def id=(id)
450
- attributes[:id] = id
451
+ @attributes[:id] = id
451
452
  end
452
453
 
453
454
  alias quoted_id id
@@ -1,5 +1,5 @@
1
1
  module ActiveHash
2
2
  module Gem
3
- VERSION = "1.5.0"
3
+ VERSION = "1.5.1"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_hash
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.0
4
+ version: 1.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeff Dean
@@ -29,7 +29,7 @@ authors:
29
29
  autorequire:
30
30
  bindir: bin
31
31
  cert_chain: []
32
- date: 2017-04-04 00:00:00.000000000 Z
32
+ date: 2017-04-20 00:00:00.000000000 Z
33
33
  dependencies:
34
34
  - !ruby/object:Gem::Dependency
35
35
  name: activesupport
@@ -87,8 +87,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
87
87
  version: '0'
88
88
  requirements: []
89
89
  rubyforge_project:
90
- rubygems_version: 2.5.1
90
+ rubygems_version: 2.5.2
91
91
  signing_key:
92
92
  specification_version: 4
93
93
  summary: An ActiveRecord-like model that uses a hash or file as a datasource
94
94
  test_files: []
95
+ has_rdoc: