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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 74424ddac245862a30ea744f4287c97c172890fb
4
- data.tar.gz: 42c2edbd0cf88620f71b22405604c4c80a8a28d7
3
+ metadata.gz: 3d76f875bac5e71ddff3431e924e1900c36c5bc7
4
+ data.tar.gz: 45071889b9a16772ab6acccf1f08fe48609772d8
5
5
  SHA512:
6
- metadata.gz: cc05aaea7469a14f9cd9e8cdc06eeb3359337a340ef72396684ed5bc573a9fe07f2175c452c0ad238aa0c2c4bf6dd8593d51d7dd908e72a4e21637dcf6d0110e
7
- data.tar.gz: 5726358d0660a9b48e479f23c747beb51e14a4999ab662613bf169c454862c1b4307159409af3b69721c72b05f9036f0f9d44b32012e5251529854fee7bf17ec
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/[USERNAME]/yaml_b_sides.
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
@@ -15,7 +15,7 @@ module YamlBSides
15
15
  keys = Array(index_for(field).find(value))
16
16
 
17
17
  keys.map do |id|
18
- find(id)
18
+ @data[id]
19
19
  end
20
20
  end
21
21
 
@@ -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
- result = @data.values.find do |datum|
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
- end
49
+ end
50
50
  end
51
51
 
52
52
  def all_indexed?(fields)
@@ -1,3 +1,3 @@
1
1
  module YamlBSides
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
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.0
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: