metrix_db 0.0.8 → 0.0.9

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.
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- metrix_db (0.0.7)
4
+ metrix_db (0.0.8)
5
5
 
6
6
  GEM
7
7
  remote: http://rubygems.org/
@@ -58,11 +58,13 @@ module MetrixDB
58
58
  def on(conditions={})
59
59
  return nil if @dataset.nil? || @fields.nil?
60
60
  @dataset.each_with_index do |data, index|
61
+ hash = {}
61
62
  conditions.each_pair do |k, v|
62
63
  if data[@fields[k.to_sym]] == v
63
- return get_from_cache(index)
64
+ hash[k.to_sym] = v
64
65
  end
65
66
  end
67
+ return get_from_cache(index) if hash == conditions
66
68
  end
67
69
  return nil
68
70
  end
@@ -1,3 +1,3 @@
1
1
  module MetrixDb
2
- VERSION = "0.0.8"
2
+ VERSION = "0.0.9"
3
3
  end
@@ -23,6 +23,12 @@ describe MetrixDB do
23
23
  @class.on(:col2 => 3).data.should == [2,3]
24
24
  end
25
25
 
26
+ it "use two conditions" do
27
+ @class.on(:col1 => 2, :col2 => 3).data.should == [2,3]
28
+ @class.on(:col1 => 1, :col2 => 2).data.should == [1,2]
29
+ end
30
+
31
+
26
32
  it "should initialize a instance" do
27
33
  @class.on(:col2 => 2).should be_kind_of @class
28
34
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metrix_db
3
3
  version: !ruby/object:Gem::Version
4
- hash: 15
4
+ hash: 13
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 8
10
- version: 0.0.8
9
+ - 9
10
+ version: 0.0.9
11
11
  platform: ruby
12
12
  authors:
13
13
  - Allen Wei