yaml_b_sides 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/yaml_b_sides/indexable.rb +1 -1
- data/lib/yaml_b_sides/queriable.rb +5 -5
- data/lib/yaml_b_sides/version.rb +1 -1
- metadata +1 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3d76f875bac5e71ddff3431e924e1900c36c5bc7
|
4
|
+
data.tar.gz: 45071889b9a16772ab6acccf1f08fe48609772d8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 238fe59f9a0a1dcb008e568fd91b045185a29658365de5cf4e98687b3d9dbe1a9dbda022e624d570ca401c8b64555d70205612710ebf0ca4a0a695d4a430aa6f
|
7
|
+
data.tar.gz: 5e2b25c21609407e1a4cf90c736a023fb9b3c651a45faad9b120f1295d722af634f92097b505073a2aa4b29e5e0f5743e2fae6db3f4a78cbcf741c3faba61900
|
data/README.md
CHANGED
@@ -96,7 +96,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
96
96
|
|
97
97
|
## Contributing
|
98
98
|
|
99
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
99
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/gaorlov/yaml_b_sides.
|
100
100
|
|
101
101
|
|
102
102
|
## License
|
@@ -10,10 +10,11 @@ module YamlBSides
|
|
10
10
|
|
11
11
|
def find_by(params = {})
|
12
12
|
if all_indexed?(params.keys)
|
13
|
-
find_by_indexed(params)
|
13
|
+
results = find_by_indexed(params)
|
14
14
|
else
|
15
|
-
find_by_scan(params)
|
15
|
+
results = find_by_scan(params)
|
16
16
|
end
|
17
|
+
new results.first
|
17
18
|
end
|
18
19
|
|
19
20
|
def all
|
@@ -29,12 +30,11 @@ module YamlBSides
|
|
29
30
|
private
|
30
31
|
|
31
32
|
def find_by_scan(params)
|
32
|
-
|
33
|
+
@data.values.select do |datum|
|
33
34
|
params.all? do |param, expcted_value|
|
34
35
|
datum[param] == expcted_value
|
35
36
|
end
|
36
37
|
end
|
37
|
-
result ? new(result) : nil
|
38
38
|
end
|
39
39
|
|
40
40
|
def find_by_indexed(params)
|
@@ -46,7 +46,7 @@ module YamlBSides
|
|
46
46
|
# find the intersection of all the sets
|
47
47
|
sets.inject( sets.first ) do |result, subset|
|
48
48
|
result & subset
|
49
|
-
|
49
|
+
end
|
50
50
|
end
|
51
51
|
|
52
52
|
def all_indexed?(fields)
|
data/lib/yaml_b_sides/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yaml_b_sides
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Greg Orlov
|
@@ -131,4 +131,3 @@ signing_key:
|
|
131
131
|
specification_version: 4
|
132
132
|
summary: A light AcriveRecord like wrapper for flat YAML files
|
133
133
|
test_files: []
|
134
|
-
has_rdoc:
|