binarylogic-searchlogic 2.1.7 → 2.1.8

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.rdoc CHANGED
@@ -1,4 +1,8 @@
1
- == 2.1.7
1
+ == 2.1.8
2
+
3
+ * Added support for not_like, not_begin_with, not_end_with, and not_null
4
+
5
+ == 2.1.7 released 2009-07-14
2
6
 
3
7
  * Add support for time zones in the Search class when type casting to Time objects.
4
8
 
data/Rakefile CHANGED
@@ -6,6 +6,7 @@ begin
6
6
  Jeweler::Tasks.new do |gem|
7
7
  gem.name = "searchlogic"
8
8
  gem.summary = "Searchlogic provides common named scopes and object based searching for ActiveRecord."
9
+ gem.description = "Searchlogic provides common named scopes and object based searching for ActiveRecord."
9
10
  gem.email = "bjohnson@binarylogic.com"
10
11
  gem.homepage = "http://github.com/binarylogic/searchlogic"
11
12
  gem.authors = ["Ben Johnson of Binary Logic"]
data/VERSION.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
2
  :major: 2
3
3
  :minor: 1
4
- :patch: 7
4
+ :patch: 8
@@ -13,12 +13,16 @@ module Searchlogic
13
13
 
14
14
  WILDCARD_CONDITIONS = {
15
15
  :like => [:contains, :includes],
16
+ :not_like => [],
16
17
  :begins_with => [:bw],
18
+ :not_begin_with => [:does_not_begin_with],
17
19
  :ends_with => [:ew],
20
+ :not_end_with => [:does_not_end_with]
18
21
  }
19
22
 
20
23
  BOOLEAN_CONDITIONS = {
21
24
  :null => [:nil],
25
+ :not_null => [:not_nil],
22
26
  :empty => []
23
27
  }
24
28
 
@@ -151,12 +155,20 @@ module Searchlogic
151
155
  scope_options(condition, column_type, "#{table_name}.#{column} > ?")
152
156
  when /^like/
153
157
  scope_options(condition, column_type, "#{table_name}.#{column} LIKE ?", :like)
158
+ when /^not_like/
159
+ scope_options(condition, column_type, "#{table_name}.#{column} NOT LIKE ?", :like)
154
160
  when /^begins_with/
155
161
  scope_options(condition, column_type, "#{table_name}.#{column} LIKE ?", :begins_with)
162
+ when /^not_begin_with/
163
+ scope_options(condition, column_type, "#{table_name}.#{column} NOT LIKE ?", :begins_with)
156
164
  when /^ends_with/
157
165
  scope_options(condition, column_type, "#{table_name}.#{column} LIKE ?", :ends_with)
166
+ when /^not_end_with/
167
+ scope_options(condition, column_type, "#{table_name}.#{column} NOT LIKE ?", :ends_with)
158
168
  when "null"
159
169
  {:conditions => "#{table_name}.#{column} IS NULL"}
170
+ when "not_null"
171
+ {:conditions => "#{table_name}.#{column} IS NOT NULL"}
160
172
  when "empty"
161
173
  {:conditions => "#{table_name}.#{column} = ''"}
162
174
  end
data/searchlogic.gemspec CHANGED
@@ -2,11 +2,12 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{searchlogic}
5
- s.version = "2.1.7"
5
+ s.version = "2.1.8"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Ben Johnson of Binary Logic"]
9
- s.date = %q{2009-07-13}
9
+ s.date = %q{2009-07-16}
10
+ s.description = %q{Searchlogic provides common named scopes and object based searching for ActiveRecord.}
10
11
  s.email = %q{bjohnson@binarylogic.com}
11
12
  s.extra_rdoc_files = [
12
13
  "LICENSE",
@@ -49,15 +49,30 @@ describe "Conditions" do
49
49
  User.username_like("john").all.should == User.find_all_by_username("bjohnson")
50
50
  end
51
51
 
52
+ it "should have not like" do
53
+ %w(bjohnson thunt).each { |username| User.create(:username => username) }
54
+ User.username_not_like("john").all.should == User.find_all_by_username("thunt")
55
+ end
56
+
52
57
  it "should have begins with" do
53
58
  %w(bjohnson thunt).each { |username| User.create(:username => username) }
54
59
  User.username_begins_with("bj").all.should == User.find_all_by_username("bjohnson")
55
60
  end
56
61
 
62
+ it "should have not begin with" do
63
+ %w(bjohnson thunt).each { |username| User.create(:username => username) }
64
+ User.username_not_begin_with("bj").all.should == User.find_all_by_username("thunt")
65
+ end
66
+
57
67
  it "should have ends with" do
58
68
  %w(bjohnson thunt).each { |username| User.create(:username => username) }
59
69
  User.username_ends_with("son").all.should == User.find_all_by_username("bjohnson")
60
70
  end
71
+
72
+ it "should have not end with" do
73
+ %w(bjohnson thunt).each { |username| User.create(:username => username) }
74
+ User.username_not_end_with("son").all.should == User.find_all_by_username("thunt")
75
+ end
61
76
  end
62
77
 
63
78
  context "boolean conditions" do
@@ -66,6 +81,11 @@ describe "Conditions" do
66
81
  User.username_null.all.should == User.find_all_by_username(nil)
67
82
  end
68
83
 
84
+ it "should have not null" do
85
+ ["bjohnson", nil].each { |username| User.create(:username => username) }
86
+ User.username_not_null.all.should == User.find_all_by_username("bjohnson")
87
+ end
88
+
69
89
  it "should have empty" do
70
90
  ["bjohnson", ""].each { |username| User.create(:username => username) }
71
91
  User.username_empty.all.should == User.find_all_by_username("")
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: binarylogic-searchlogic
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.7
4
+ version: 2.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Johnson of Binary Logic
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-07-13 00:00:00 -07:00
12
+ date: 2009-07-16 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -22,7 +22,7 @@ dependencies:
22
22
  - !ruby/object:Gem::Version
23
23
  version: 2.0.0
24
24
  version:
25
- description:
25
+ description: Searchlogic provides common named scopes and object based searching for ActiveRecord.
26
26
  email: bjohnson@binarylogic.com
27
27
  executables: []
28
28