memorydb 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/memorydb/db.rb +6 -6
  2. metadata +2 -2
@@ -146,10 +146,10 @@ module MemoryDb
146
146
  case filter.operator
147
147
  when '='; value == filter.value
148
148
  when '!='; value != filter.value
149
- when '<'; value && value < filter.value
150
- when '<='; value && value <= filter.value
151
- when '>'; value && value > filter.value
152
- when '>='; value && value >= filter.value
149
+ when '<'; value && (value < filter.value)
150
+ when '<='; value && (value <= filter.value)
151
+ when '>'; value && (value > filter.value)
152
+ when '>='; value && (value >= filter.value)
153
153
  when 'in'; filter.value.include?(value)
154
154
  when '!in'; !filter.value.include?(value)
155
155
  when 'or'; filter.value.any? do |sub_filter|
@@ -178,8 +178,8 @@ module MemoryDb
178
178
  def compare_model(model1, model2, sort)
179
179
  field1, field2 = model1[sort.field], model2[sort.field]
180
180
  field1 == field2 ? nil :
181
- field1 < field2 && sort.order == :asc ? -1 :
182
- field1 > field2 && sort.order == :desc ? -1 : 1
181
+ (field1.nil? ? true : (field1 < field2)) && sort.order == :asc ? -1 :
182
+ (field1.nil? ? false : (field1 > field2)) && sort.order == :desc ? -1 : 1
183
183
  end
184
184
 
185
185
  def limit_models(models, limit)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: memorydb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-07-12 00:00:00.000000000 Z
12
+ date: 2013-08-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake