active_hash 2.2.0 → 2.2.1

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: 88911736a7baf25f50316f0f8cff64da3d75b0cf4e5ec4da716acae358390308
4
- data.tar.gz: aec89dbc9f68f10e86b2e2b7ea4bdecfd42043a917baf7e3aa7a0c85f15969e3
3
+ metadata.gz: 10c4404df7bb2e1659918a3e599661a7639dd0a5ed4404a9934d114aa54c0393
4
+ data.tar.gz: 528d4a632658db0ef6f6a35a3abb8783b039b153bd0b728b026d0ce7d6052c98
5
5
  SHA512:
6
- metadata.gz: 80a28ac67124190ca5dcff815a0e0dc923f3cc5a8401965de64ae53e0feb8901fd3bc6bfcedd4deb8c86b83ba4b16190b2e098eee0a2ee3e5db6b07bd1ad0815
7
- data.tar.gz: 25de0710d0f570a6486153f46a987d8f95187b71f95338b5e54ce0a1e529df4cd6d91e7097c3ed45f80072f38647a3821fbcd7354e06b9d0c415e48b7fcb7487
6
+ metadata.gz: 97f468d94928db136e9d76fd3e44e502e1e77ea2b764c1a070350d08d63fdc8ca524f81786035641681685f506dab94056b07bce05698a0a16a5a9f948e92e08
7
+ data.tar.gz: 5361a8ecb16cad65278e096ad58f80103f517043f422d26032c2c213370ebcf369dab9597cba21f372d42ad198d6c22ba06b2a7b611078e78aeb7fe99477f231
data/CHANGELOG CHANGED
@@ -1,3 +1,6 @@
1
+ 2019-03-06 (v2.2.1)
2
+ - Allow empty YAML [#171](https://github.com/zilkey/active_hash/pull/171) Thanks, @ppworks
3
+
1
4
  2018-11-22 (v2.2.0)
2
5
  - Support pluck method [#164](https://github.com/zilkey/active_hash/pull/164) Thanks, @ihatov08
3
6
  - Support where.not method [#167](https://github.com/zilkey/active_hash/pull/167) Thanks, @DialBird
data/README.md CHANGED
@@ -148,17 +148,19 @@ If you prefer to store your data in YAML, see below.
148
148
 
149
149
  ActiveHash gives you ActiveRecord-esque methods like:
150
150
  ```ruby
151
- Country.all # => returns all Country objects
152
- Country.count # => returns the length of the .data array
153
- Country.first # => returns the first country object
154
- Country.last # => returns the last country object
155
- Country.find 1 # => returns the first country object with that id
156
- Country.find [1,2] # => returns all Country objects with ids in the array
157
- Country.find :all # => same as .all
158
- Country.find :all, args # => the second argument is totally ignored, but allows it to play nicely with AR
159
- Country.find_by_id 1 # => find the first object that matches the id
160
- Country.find_by(name: 'US') # => returns the first country object with specified argument
161
- Country.find_by!(name: 'US') # => same as find_by, but raise exception when not found
151
+ Country.all # => returns all Country objects
152
+ Country.count # => returns the length of the .data array
153
+ Country.first # => returns the first country object
154
+ Country.last # => returns the last country object
155
+ Country.find 1 # => returns the first country object with that id
156
+ Country.find [1,2] # => returns all Country objects with ids in the array
157
+ Country.find :all # => same as .all
158
+ Country.find :all, args # => the second argument is totally ignored, but allows it to play nicely with AR
159
+ Country.find_by_id 1 # => find the first object that matches the id
160
+ Country.find_by(name: 'US') # => returns the first country object with specified argument
161
+ Country.find_by!(name: 'US') # => same as find_by, but raise exception when not found
162
+ Country.where(name: 'US') # => returns all records with name: 'US'
163
+ Country.where.not(name: 'US') # => returns all records without name: 'US'
162
164
  ```
163
165
  It also gives you a few dynamic finder methods. For example, if you defined :name as a field, you'd get:
164
166
  ```ruby
@@ -1,5 +1,5 @@
1
1
  module ActiveHash
2
2
  module Gem
3
- VERSION = "2.2.0"
3
+ VERSION = "2.2.1"
4
4
  end
5
5
  end
@@ -5,7 +5,7 @@ module ActiveJSON
5
5
  def load_file
6
6
  if (data = raw_data).is_a?(Array)
7
7
  data
8
- else
8
+ elsif data.respond_to?(:values)
9
9
  data.values
10
10
  end
11
11
  end
@@ -8,7 +8,7 @@ module ActiveYaml
8
8
  def load_file
9
9
  if (data = raw_data).is_a?(Array)
10
10
  data
11
- else
11
+ elsif data.respond_to?(:values)
12
12
  data.values
13
13
  end
14
14
  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: 2.2.0
4
+ version: 2.2.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: 2018-11-22 00:00:00.000000000 Z
32
+ date: 2019-03-06 00:00:00.000000000 Z
33
33
  dependencies:
34
34
  - !ruby/object:Gem::Dependency
35
35
  name: activesupport