everywhere 0.0.1 → 0.1.0
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.
- data/README.rdoc +11 -3
- data/lib/everywhere/hash_key.rb +10 -4
- data/lib/everywhere/hash_value.rb +12 -6
- data/lib/everywhere/method.rb +9 -1
- data/lib/everywhere/symbol.rb +4 -1
- data/lib/everywhere/version.rb +1 -1
- data/spec/hash_key_spec.rb +44 -30
- data/spec/hash_value_spec.rb +44 -30
- data/spec/method_spec.rb +44 -30
- data/spec/symbol_spec.rb +44 -30
- metadata +46 -74
data/README.rdoc
CHANGED
@@ -11,7 +11,13 @@ Hash condition syntax for AR query everywhere!
|
|
11
11
|
|
12
12
|
SELECT "users".* FROM "users" WHERE ("users"."name" != 'foo')
|
13
13
|
SELECT "users".* FROM "users" WHERE ("users"."created_at" IS NOT NULL)
|
14
|
-
SELECT "users".* FROM "users" WHERE ("users"."status" NOT IN ('inactive', 'deleted')
|
14
|
+
SELECT "users".* FROM "users" WHERE ("users"."status" NOT IN ('inactive', 'deleted'))
|
15
|
+
|
16
|
+
=== where + like
|
17
|
+
|
18
|
+
Same for where + like.
|
19
|
+
|
20
|
+
SELECT "users".* FROM "users" WHERE ("users"."name" LIKE 'Akira%')
|
15
21
|
|
16
22
|
|
17
23
|
== Syntaxes
|
@@ -40,9 +46,11 @@ Put +:not+ as the first parameter of +where+ method.
|
|
40
46
|
* method
|
41
47
|
Use the special method named +where_not+.
|
42
48
|
|
43
|
-
User.where_not(:
|
49
|
+
User.where_not(:name => 'foo')
|
44
50
|
=> SELECT "users".* FROM "users" WHERE ("users"."name" != 'foo')
|
45
51
|
|
52
|
+
See specs for more details.
|
53
|
+
|
46
54
|
|
47
55
|
== Supported versions
|
48
56
|
|
@@ -66,7 +74,7 @@ The default value is +:hash_value+.
|
|
66
74
|
|
67
75
|
== Todo
|
68
76
|
|
69
|
-
+
|
77
|
+
+not like+ (if needed)
|
70
78
|
|
71
79
|
|
72
80
|
== Contributing to Everywhere
|
data/lib/everywhere/hash_key.rb
CHANGED
@@ -10,9 +10,9 @@ module ActiveRecord
|
|
10
10
|
attributes_with_not = {}
|
11
11
|
attributes.each do |column, value|
|
12
12
|
# {not: {key: value}}
|
13
|
-
if column
|
13
|
+
if column.in?([:not, :like])
|
14
14
|
value.each do |k, v|
|
15
|
-
attributes_with_not["#{k}
|
15
|
+
attributes_with_not["#{k}__#{column}__"] = v
|
16
16
|
end
|
17
17
|
else
|
18
18
|
attributes_with_not[column] = value
|
@@ -22,6 +22,9 @@ module ActiveRecord
|
|
22
22
|
if rel.left.name.to_s.ends_with? '__not__'
|
23
23
|
rel.left.name = rel.left.name.to_s.sub(/__not__$/, '').to_sym
|
24
24
|
negate rel
|
25
|
+
elsif rel.left.name.to_s.ends_with? '__like__'
|
26
|
+
rel.left.name = rel.left.name.to_s.sub(/__like__$/, '').to_sym
|
27
|
+
Arel::Nodes::Matches.new rel.left, rel.right
|
25
28
|
else
|
26
29
|
rel
|
27
30
|
end
|
@@ -36,9 +39,9 @@ module ActiveRecord
|
|
36
39
|
attributes_with_not = {}
|
37
40
|
attributes.each do |column, value|
|
38
41
|
# {not: {key: value}}
|
39
|
-
if column == :not
|
42
|
+
if (column == :not) || (column == :like)
|
40
43
|
value.each do |k, v|
|
41
|
-
attributes_with_not["#{k}
|
44
|
+
attributes_with_not["#{k}__#{column}__"] = v
|
42
45
|
end
|
43
46
|
else
|
44
47
|
attributes_with_not[column] = value
|
@@ -48,6 +51,9 @@ module ActiveRecord
|
|
48
51
|
if rel.left.name.to_s.ends_with? '__not__'
|
49
52
|
rel.left.name = rel.left.name.to_s.sub(/__not__$/, '').to_sym
|
50
53
|
negate rel
|
54
|
+
elsif rel.left.name.to_s.ends_with? '__like__'
|
55
|
+
rel.left.name = rel.left.name.to_s.sub(/__like__$/, '').to_sym
|
56
|
+
Arel::Nodes::Matches.new rel.left, rel.right
|
51
57
|
else
|
52
58
|
rel
|
53
59
|
end
|
@@ -9,16 +9,19 @@ module ActiveRecord
|
|
9
9
|
def build_from_hash_with_not(engine, attributes, default_table)
|
10
10
|
attributes_with_not = attributes.map do |column, value|
|
11
11
|
# {key: {not: value}}
|
12
|
-
if value.is_a?(Hash) && (value.keys.size == 1) &&
|
13
|
-
["#{column}
|
12
|
+
if value.is_a?(Hash) && (value.keys.size == 1) && value.keys.first.in?([:not, :like])
|
13
|
+
["#{column}__#{value.keys.first}__", value.values.first]
|
14
14
|
else
|
15
15
|
[column, value]
|
16
16
|
end
|
17
17
|
end
|
18
18
|
build_from_hash_without_not(engine, attributes_with_not, default_table).map do |rel|
|
19
|
-
if rel.left.name.to_s.ends_with?
|
19
|
+
if rel.left.name.to_s.ends_with?('__not__')
|
20
20
|
rel.left.name = rel.left.name.to_s.sub(/__not__$/, '').to_sym
|
21
21
|
negate rel
|
22
|
+
elsif rel.left.name.to_s.ends_with?('__like__')
|
23
|
+
rel.left.name = rel.left.name.to_s.sub(/__like__$/, '').to_sym
|
24
|
+
Arel::Nodes::Matches.new rel.left, rel.right
|
22
25
|
else
|
23
26
|
rel
|
24
27
|
end
|
@@ -32,16 +35,19 @@ module ActiveRecord
|
|
32
35
|
def build_from_hash_with_not(attributes, default_table)
|
33
36
|
attributes_with_not = attributes.map do |column, value|
|
34
37
|
# {key: {not: value}}
|
35
|
-
if value.is_a?(Hash) && (value.keys.size == 1) && (value.keys.first == :not)
|
36
|
-
["#{column}
|
38
|
+
if value.is_a?(Hash) && (value.keys.size == 1) && ((value.keys.first == :not) || (value.keys.first == :like))
|
39
|
+
["#{column}__#{value.keys.first}__", value.values.first]
|
37
40
|
else
|
38
41
|
[column, value]
|
39
42
|
end
|
40
43
|
end
|
41
44
|
build_from_hash_without_not(attributes_with_not, default_table).map do |rel|
|
42
|
-
if rel.left.name.to_s.ends_with?
|
45
|
+
if rel.left.name.to_s.ends_with?('__not__')
|
43
46
|
rel.left.name = rel.left.name.to_s.sub(/__not__$/, '').to_sym
|
44
47
|
negate rel
|
48
|
+
elsif rel.left.name.to_s.ends_with?('__like__')
|
49
|
+
rel.left.name = rel.left.name.to_s.sub(/__like__$/, '').to_sym
|
50
|
+
Arel::Nodes::Matches.new rel.left, rel.right
|
45
51
|
else
|
46
52
|
rel
|
47
53
|
end
|
data/lib/everywhere/method.rb
CHANGED
@@ -3,7 +3,7 @@ require 'everywhere/util'
|
|
3
3
|
module ActiveRecord
|
4
4
|
class Base
|
5
5
|
class << self
|
6
|
-
delegate :where_not, :to => :scoped
|
6
|
+
delegate :where_not, :where_like, :to => :scoped
|
7
7
|
end
|
8
8
|
end
|
9
9
|
|
@@ -17,5 +17,13 @@ module ActiveRecord
|
|
17
17
|
relation.where_values += build_where(opts, rest).map {|r| negate r}
|
18
18
|
relation
|
19
19
|
end
|
20
|
+
|
21
|
+
def where_like(opts, *rest)
|
22
|
+
return self if opts.blank?
|
23
|
+
|
24
|
+
relation = clone
|
25
|
+
relation.where_values += build_where(opts, rest).map {|r| Arel::Nodes::Matches.new r.left, r.right}
|
26
|
+
relation
|
27
|
+
end
|
20
28
|
end
|
21
29
|
end
|
data/lib/everywhere/symbol.rb
CHANGED
@@ -5,8 +5,11 @@ module ActiveRecord
|
|
5
5
|
include Everywhere::Util
|
6
6
|
|
7
7
|
def build_where_with_not(opts, other = [])
|
8
|
-
|
8
|
+
case opts
|
9
|
+
when :not
|
9
10
|
build_where_without_not(*other).map {|r| negate r}
|
11
|
+
when :like
|
12
|
+
build_where_without_not(*other).map {|r| Arel::Nodes::Matches.new r.left, r.right}
|
10
13
|
else
|
11
14
|
build_where_without_not(opts, other)
|
12
15
|
end
|
data/lib/everywhere/version.rb
CHANGED
data/spec/hash_key_spec.rb
CHANGED
@@ -11,42 +11,56 @@ describe 'normal query' do
|
|
11
11
|
its(:to_sql) { should == %q["posts"."title" = 'hello'] }
|
12
12
|
end
|
13
13
|
|
14
|
-
describe 'not
|
15
|
-
|
16
|
-
|
14
|
+
describe 'not' do
|
15
|
+
describe 'not eq' do
|
16
|
+
before do
|
17
|
+
@where = Post.where(:not => {:title => 'hello'}).where_values
|
18
|
+
end
|
19
|
+
subject { @where }
|
20
|
+
it { @where.should have(1).item }
|
21
|
+
subject { @where.first }
|
22
|
+
its(:to_sql) { should == %q["posts"."title" != 'hello'] }
|
17
23
|
end
|
18
|
-
subject { @where }
|
19
|
-
it { @where.should have(1).item }
|
20
|
-
subject { @where.first }
|
21
|
-
its(:to_sql) { should == %q["posts"."title" != 'hello'] }
|
22
|
-
end
|
23
24
|
|
24
|
-
describe 'not null' do
|
25
|
-
|
26
|
-
|
25
|
+
describe 'not null' do
|
26
|
+
before do
|
27
|
+
@where = Post.where(:not => {:created_at => nil}).where_values
|
28
|
+
end
|
29
|
+
subject { @where }
|
30
|
+
it { @where.should have(1).item }
|
31
|
+
subject { @where.first }
|
32
|
+
its(:to_sql) { should == %q["posts"."created_at" IS NOT NULL] }
|
27
33
|
end
|
28
|
-
subject { @where }
|
29
|
-
it { @where.should have(1).item }
|
30
|
-
subject { @where.first }
|
31
|
-
its(:to_sql) { should == %q["posts"."created_at" IS NOT NULL] }
|
32
|
-
end
|
33
34
|
|
34
|
-
describe 'not in' do
|
35
|
-
|
36
|
-
|
35
|
+
describe 'not in' do
|
36
|
+
before do
|
37
|
+
@where = Post.where(:not => {:title => %w[hello goodbye]}).where_values
|
38
|
+
end
|
39
|
+
subject { @where }
|
40
|
+
it { @where.should have(1).item }
|
41
|
+
subject { @where.first }
|
42
|
+
its(:to_sql) { should == %q["posts"."title" NOT IN ('hello', 'goodbye')] }
|
43
|
+
end
|
44
|
+
|
45
|
+
describe 'association' do
|
46
|
+
before do
|
47
|
+
@where = Post.joins(:comments).where(:comments => {:not => {:body => 'foo'}}).where_values
|
48
|
+
end
|
49
|
+
subject { @where }
|
50
|
+
it { @where.should have(1).item }
|
51
|
+
subject { @where.first }
|
52
|
+
its(:to_sql) { should == %q["comments"."body" != 'foo'] }
|
37
53
|
end
|
38
|
-
subject { @where }
|
39
|
-
it { @where.should have(1).item }
|
40
|
-
subject { @where.first }
|
41
|
-
its(:to_sql) { should == %q["posts"."title" NOT IN ('hello', 'goodbye')] }
|
42
54
|
end
|
43
55
|
|
44
|
-
describe '
|
45
|
-
|
46
|
-
|
56
|
+
describe 'like' do
|
57
|
+
describe 'like match' do
|
58
|
+
before do
|
59
|
+
@where = Post.where(:like => {:title => 'he%'}).where_values
|
60
|
+
end
|
61
|
+
subject { @where }
|
62
|
+
it { @where.should have(1).item }
|
63
|
+
subject { @where.first }
|
64
|
+
its(:to_sql) { should == %q["posts"."title" LIKE 'he%'] }
|
47
65
|
end
|
48
|
-
subject { @where }
|
49
|
-
it { @where.should have(1).item }
|
50
|
-
subject { @where.first }
|
51
|
-
its(:to_sql) { should == %q["comments"."body" != 'foo'] }
|
52
66
|
end
|
data/spec/hash_value_spec.rb
CHANGED
@@ -11,42 +11,56 @@ describe 'normal query' do
|
|
11
11
|
its(:to_sql) { should == %q["posts"."title" = 'hello'] }
|
12
12
|
end
|
13
13
|
|
14
|
-
describe 'not
|
15
|
-
|
16
|
-
|
14
|
+
describe 'not' do
|
15
|
+
describe 'not eq' do
|
16
|
+
before do
|
17
|
+
@where = Post.where(:title => {:not => 'hello'}).where_values
|
18
|
+
end
|
19
|
+
subject { @where }
|
20
|
+
it { @where.should have(1).item }
|
21
|
+
subject { @where.first }
|
22
|
+
its(:to_sql) { should == %q["posts"."title" != 'hello'] }
|
17
23
|
end
|
18
|
-
subject { @where }
|
19
|
-
it { @where.should have(1).item }
|
20
|
-
subject { @where.first }
|
21
|
-
its(:to_sql) { should == %q["posts"."title" != 'hello'] }
|
22
|
-
end
|
23
24
|
|
24
|
-
describe 'not null' do
|
25
|
-
|
26
|
-
|
25
|
+
describe 'not null' do
|
26
|
+
before do
|
27
|
+
@where = Post.where(:created_at => {:not => nil}).where_values
|
28
|
+
end
|
29
|
+
subject { @where }
|
30
|
+
it { @where.should have(1).item }
|
31
|
+
subject { @where.first }
|
32
|
+
its(:to_sql) { should == %q["posts"."created_at" IS NOT NULL] }
|
27
33
|
end
|
28
|
-
subject { @where }
|
29
|
-
it { @where.should have(1).item }
|
30
|
-
subject { @where.first }
|
31
|
-
its(:to_sql) { should == %q["posts"."created_at" IS NOT NULL] }
|
32
|
-
end
|
33
34
|
|
34
|
-
describe 'not in' do
|
35
|
-
|
36
|
-
|
35
|
+
describe 'not in' do
|
36
|
+
before do
|
37
|
+
@where = Post.where(:title => {:not => %w[hello goodbye]}).where_values
|
38
|
+
end
|
39
|
+
subject { @where }
|
40
|
+
it { @where.should have(1).item }
|
41
|
+
subject { @where.first }
|
42
|
+
its(:to_sql) { should == %q["posts"."title" NOT IN ('hello', 'goodbye')] }
|
43
|
+
end
|
44
|
+
|
45
|
+
describe 'association' do
|
46
|
+
before do
|
47
|
+
@where = Post.joins(:comments).where(:comments => {:body => {:not => 'foo'}}).where_values
|
48
|
+
end
|
49
|
+
subject { @where }
|
50
|
+
it { @where.should have(1).item }
|
51
|
+
subject { @where.first }
|
52
|
+
its(:to_sql) { should == %q["comments"."body" != 'foo'] }
|
37
53
|
end
|
38
|
-
subject { @where }
|
39
|
-
it { @where.should have(1).item }
|
40
|
-
subject { @where.first }
|
41
|
-
its(:to_sql) { should == %q["posts"."title" NOT IN ('hello', 'goodbye')] }
|
42
54
|
end
|
43
55
|
|
44
|
-
describe '
|
45
|
-
|
46
|
-
|
56
|
+
describe 'like' do
|
57
|
+
describe 'like match' do
|
58
|
+
before do
|
59
|
+
@where = Post.where(:title => {:like => 'he%'}).where_values
|
60
|
+
end
|
61
|
+
subject { @where }
|
62
|
+
it { @where.should have(1).item }
|
63
|
+
subject { @where.first }
|
64
|
+
its(:to_sql) { should == %q["posts"."title" LIKE 'he%'] }
|
47
65
|
end
|
48
|
-
subject { @where }
|
49
|
-
it { @where.should have(1).item }
|
50
|
-
subject { @where.first }
|
51
|
-
its(:to_sql) { should == %q["comments"."body" != 'foo'] }
|
52
66
|
end
|
data/spec/method_spec.rb
CHANGED
@@ -11,42 +11,56 @@ describe 'normal query' do
|
|
11
11
|
its(:to_sql) { should == %q["posts"."name" = 'hello'] }
|
12
12
|
end
|
13
13
|
|
14
|
-
describe 'not
|
15
|
-
|
16
|
-
|
14
|
+
describe 'not' do
|
15
|
+
describe 'not eq' do
|
16
|
+
before do
|
17
|
+
@where = Post.where_not(:name => 'hello').where_values
|
18
|
+
end
|
19
|
+
subject { @where }
|
20
|
+
it { @where.should have(1).item }
|
21
|
+
subject { @where.first }
|
22
|
+
its(:to_sql) { should == %q["posts"."name" != 'hello'] }
|
17
23
|
end
|
18
|
-
subject { @where }
|
19
|
-
it { @where.should have(1).item }
|
20
|
-
subject { @where.first }
|
21
|
-
its(:to_sql) { should == %q["posts"."name" != 'hello'] }
|
22
|
-
end
|
23
24
|
|
24
|
-
describe 'not null' do
|
25
|
-
|
26
|
-
|
25
|
+
describe 'not null' do
|
26
|
+
before do
|
27
|
+
@where = Post.where_not(:created_at => nil).where_values
|
28
|
+
end
|
29
|
+
subject { @where }
|
30
|
+
it { @where.should have(1).item }
|
31
|
+
subject { @where.first }
|
32
|
+
its(:to_sql) { should == %q["posts"."created_at" IS NOT NULL] }
|
27
33
|
end
|
28
|
-
subject { @where }
|
29
|
-
it { @where.should have(1).item }
|
30
|
-
subject { @where.first }
|
31
|
-
its(:to_sql) { should == %q["posts"."created_at" IS NOT NULL] }
|
32
|
-
end
|
33
34
|
|
34
|
-
describe 'not in' do
|
35
|
-
|
36
|
-
|
35
|
+
describe 'not in' do
|
36
|
+
before do
|
37
|
+
@where = Post.where_not(:name => %w[hello goodbye]).where_values
|
38
|
+
end
|
39
|
+
subject { @where }
|
40
|
+
it { @where.should have(1).item }
|
41
|
+
subject { @where.first }
|
42
|
+
its(:to_sql) { should == %q["posts"."name" NOT IN ('hello', 'goodbye')] }
|
43
|
+
end
|
44
|
+
|
45
|
+
describe 'association' do
|
46
|
+
before do
|
47
|
+
@where = Post.joins(:comments).where_not(:comments => {:body => 'foo'}).where_values
|
48
|
+
end
|
49
|
+
subject { @where }
|
50
|
+
it { @where.should have(1).item }
|
51
|
+
subject { @where.first }
|
52
|
+
its(:to_sql) { should == %q["comments"."body" != 'foo'] }
|
37
53
|
end
|
38
|
-
subject { @where }
|
39
|
-
it { @where.should have(1).item }
|
40
|
-
subject { @where.first }
|
41
|
-
its(:to_sql) { should == %q["posts"."name" NOT IN ('hello', 'goodbye')] }
|
42
54
|
end
|
43
55
|
|
44
|
-
describe '
|
45
|
-
|
46
|
-
|
56
|
+
describe 'like' do
|
57
|
+
describe 'like match' do
|
58
|
+
before do
|
59
|
+
@where = Post.where_like(:title => 'he%').where_values
|
60
|
+
end
|
61
|
+
subject { @where }
|
62
|
+
it { @where.should have(1).item }
|
63
|
+
subject { @where.first }
|
64
|
+
its(:to_sql) { should == %q["posts"."title" LIKE 'he%'] }
|
47
65
|
end
|
48
|
-
subject { @where }
|
49
|
-
it { @where.should have(1).item }
|
50
|
-
subject { @where.first }
|
51
|
-
its(:to_sql) { should == %q["comments"."body" != 'foo'] }
|
52
66
|
end
|
data/spec/symbol_spec.rb
CHANGED
@@ -11,42 +11,56 @@ describe 'normal query' do
|
|
11
11
|
its(:to_sql) { should == %q["posts"."name" = 'hello'] }
|
12
12
|
end
|
13
13
|
|
14
|
-
describe 'not
|
15
|
-
|
16
|
-
|
14
|
+
describe 'not' do
|
15
|
+
describe 'not eq' do
|
16
|
+
before do
|
17
|
+
@where = Post.where(:not, :name => 'hello').where_values
|
18
|
+
end
|
19
|
+
subject { @where }
|
20
|
+
it { @where.should have(1).item }
|
21
|
+
subject { @where.first }
|
22
|
+
its(:to_sql) { should == %q["posts"."name" != 'hello'] }
|
17
23
|
end
|
18
|
-
subject { @where }
|
19
|
-
it { @where.should have(1).item }
|
20
|
-
subject { @where.first }
|
21
|
-
its(:to_sql) { should == %q["posts"."name" != 'hello'] }
|
22
|
-
end
|
23
24
|
|
24
|
-
describe 'not null' do
|
25
|
-
|
26
|
-
|
25
|
+
describe 'not null' do
|
26
|
+
before do
|
27
|
+
@where = Post.where(:not, :created_at => nil).where_values
|
28
|
+
end
|
29
|
+
subject { @where }
|
30
|
+
it { @where.should have(1).item }
|
31
|
+
subject { @where.first }
|
32
|
+
its(:to_sql) { should == %q["posts"."created_at" IS NOT NULL] }
|
27
33
|
end
|
28
|
-
subject { @where }
|
29
|
-
it { @where.should have(1).item }
|
30
|
-
subject { @where.first }
|
31
|
-
its(:to_sql) { should == %q["posts"."created_at" IS NOT NULL] }
|
32
|
-
end
|
33
34
|
|
34
|
-
describe 'not in' do
|
35
|
-
|
36
|
-
|
35
|
+
describe 'not in' do
|
36
|
+
before do
|
37
|
+
@where = Post.where(:not, :name => %w[hello goodbye]).where_values
|
38
|
+
end
|
39
|
+
subject { @where }
|
40
|
+
it { @where.should have(1).item }
|
41
|
+
subject { @where.first }
|
42
|
+
its(:to_sql) { should == %q["posts"."name" NOT IN ('hello', 'goodbye')] }
|
43
|
+
end
|
44
|
+
|
45
|
+
describe 'association' do
|
46
|
+
before do
|
47
|
+
@where = Post.joins(:comments).where(:not, :comments => {:body => 'foo'}).where_values
|
48
|
+
end
|
49
|
+
subject { @where }
|
50
|
+
it { @where.should have(1).item }
|
51
|
+
subject { @where.first }
|
52
|
+
its(:to_sql) { should == %q["comments"."body" != 'foo'] }
|
37
53
|
end
|
38
|
-
subject { @where }
|
39
|
-
it { @where.should have(1).item }
|
40
|
-
subject { @where.first }
|
41
|
-
its(:to_sql) { should == %q["posts"."name" NOT IN ('hello', 'goodbye')] }
|
42
54
|
end
|
43
55
|
|
44
|
-
describe '
|
45
|
-
|
46
|
-
|
56
|
+
describe 'like' do
|
57
|
+
describe 'like match' do
|
58
|
+
before do
|
59
|
+
@where = Post.where(:like, :title => 'he%').where_values
|
60
|
+
end
|
61
|
+
subject { @where }
|
62
|
+
it { @where.should have(1).item }
|
63
|
+
subject { @where.first }
|
64
|
+
its(:to_sql) { should == %q["posts"."title" LIKE 'he%'] }
|
47
65
|
end
|
48
|
-
subject { @where }
|
49
|
-
it { @where.should have(1).item }
|
50
|
-
subject { @where.first }
|
51
|
-
its(:to_sql) { should == %q["comments"."body" != 'foo'] }
|
52
66
|
end
|
metadata
CHANGED
@@ -1,74 +1,56 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: everywhere
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 0
|
9
|
-
- 1
|
10
|
-
version: 0.0.1
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Akira Matsuda
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2011-11-25 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
21
15
|
name: rspec
|
22
|
-
|
23
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
16
|
+
requirement: &70251485850240 !ruby/object:Gem::Requirement
|
24
17
|
none: false
|
25
|
-
requirements:
|
26
|
-
- -
|
27
|
-
- !ruby/object:Gem::Version
|
28
|
-
|
29
|
-
segments:
|
30
|
-
- 0
|
31
|
-
version: "0"
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
32
22
|
type: :development
|
33
|
-
version_requirements: *id001
|
34
|
-
- !ruby/object:Gem::Dependency
|
35
|
-
name: sqlite3
|
36
23
|
prerelease: false
|
37
|
-
|
24
|
+
version_requirements: *70251485850240
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: sqlite3
|
27
|
+
requirement: &70251485849520 !ruby/object:Gem::Requirement
|
38
28
|
none: false
|
39
|
-
requirements:
|
40
|
-
- -
|
41
|
-
- !ruby/object:Gem::Version
|
42
|
-
|
43
|
-
segments:
|
44
|
-
- 0
|
45
|
-
version: "0"
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
46
33
|
type: :development
|
47
|
-
version_requirements: *id002
|
48
|
-
- !ruby/object:Gem::Dependency
|
49
|
-
name: activerecord
|
50
34
|
prerelease: false
|
51
|
-
|
35
|
+
version_requirements: *70251485849520
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: activerecord
|
38
|
+
requirement: &70251485868380 !ruby/object:Gem::Requirement
|
52
39
|
none: false
|
53
|
-
requirements:
|
54
|
-
- -
|
55
|
-
- !ruby/object:Gem::Version
|
56
|
-
|
57
|
-
segments:
|
58
|
-
- 0
|
59
|
-
version: "0"
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
60
44
|
type: :runtime
|
61
|
-
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *70251485868380
|
62
47
|
description: Hash condition syntax for AR query everywhere!
|
63
|
-
email:
|
48
|
+
email:
|
64
49
|
- ronnie@dio.jp
|
65
50
|
executables: []
|
66
|
-
|
67
51
|
extensions: []
|
68
|
-
|
69
52
|
extra_rdoc_files: []
|
70
|
-
|
71
|
-
files:
|
53
|
+
files:
|
72
54
|
- .gitignore
|
73
55
|
- .rspec
|
74
56
|
- Gemfile
|
@@ -89,43 +71,33 @@ files:
|
|
89
71
|
- spec/method_spec.rb
|
90
72
|
- spec/spec_helper.rb
|
91
73
|
- spec/symbol_spec.rb
|
92
|
-
homepage:
|
74
|
+
homepage: ''
|
93
75
|
licenses: []
|
94
|
-
|
95
76
|
post_install_message:
|
96
77
|
rdoc_options: []
|
97
|
-
|
98
|
-
require_paths:
|
78
|
+
require_paths:
|
99
79
|
- lib
|
100
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
80
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
101
81
|
none: false
|
102
|
-
requirements:
|
103
|
-
- -
|
104
|
-
- !ruby/object:Gem::Version
|
105
|
-
|
106
|
-
|
107
|
-
- 0
|
108
|
-
version: "0"
|
109
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
82
|
+
requirements:
|
83
|
+
- - ! '>='
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
86
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
110
87
|
none: false
|
111
|
-
requirements:
|
112
|
-
- -
|
113
|
-
- !ruby/object:Gem::Version
|
114
|
-
|
115
|
-
segments:
|
116
|
-
- 0
|
117
|
-
version: "0"
|
88
|
+
requirements:
|
89
|
+
- - ! '>='
|
90
|
+
- !ruby/object:Gem::Version
|
91
|
+
version: '0'
|
118
92
|
requirements: []
|
119
|
-
|
120
93
|
rubyforge_project: everywhere
|
121
|
-
rubygems_version: 1.8.
|
94
|
+
rubygems_version: 1.8.10
|
122
95
|
signing_key:
|
123
96
|
specification_version: 3
|
124
97
|
summary: Hash condition syntax for AR query everywhere!
|
125
|
-
test_files:
|
98
|
+
test_files:
|
126
99
|
- spec/hash_key_spec.rb
|
127
100
|
- spec/hash_value_spec.rb
|
128
101
|
- spec/method_spec.rb
|
129
102
|
- spec/spec_helper.rb
|
130
103
|
- spec/symbol_spec.rb
|
131
|
-
has_rdoc:
|