active_hash 2.2.0 → 2.2.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 +4 -4
- data/CHANGELOG +3 -0
- data/README.md +13 -11
- data/lib/active_hash/version.rb +1 -1
- data/lib/active_json/base.rb +1 -1
- data/lib/active_yaml/base.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 10c4404df7bb2e1659918a3e599661a7639dd0a5ed4404a9934d114aa54c0393
|
|
4
|
+
data.tar.gz: 528d4a632658db0ef6f6a35a3abb8783b039b153bd0b728b026d0ce7d6052c98
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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
|
|
152
|
-
Country.count
|
|
153
|
-
Country.first
|
|
154
|
-
Country.last
|
|
155
|
-
Country.find 1
|
|
156
|
-
Country.find [1,2]
|
|
157
|
-
Country.find :all
|
|
158
|
-
Country.find :all, args
|
|
159
|
-
Country.find_by_id 1
|
|
160
|
-
Country.find_by(name: 'US')
|
|
161
|
-
Country.find_by!(name: 'US')
|
|
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
|
data/lib/active_hash/version.rb
CHANGED
data/lib/active_json/base.rb
CHANGED
data/lib/active_yaml/base.rb
CHANGED
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.
|
|
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:
|
|
32
|
+
date: 2019-03-06 00:00:00.000000000 Z
|
|
33
33
|
dependencies:
|
|
34
34
|
- !ruby/object:Gem::Dependency
|
|
35
35
|
name: activesupport
|