squeel 0.8.10 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +48 -0
- data/lib/squeel/adapters/active_record.rb +13 -11
- data/lib/squeel/adapters/active_record/3.0/{association_preload.rb → association_preload_extensions.rb} +1 -1
- data/lib/squeel/adapters/active_record/3.0/context.rb +10 -0
- data/lib/squeel/adapters/active_record/3.0/{relation.rb → relation_extensions.rb} +1 -1
- data/lib/squeel/adapters/active_record/base_extensions.rb +22 -0
- data/lib/squeel/adapters/active_record/context.rb +10 -0
- data/lib/squeel/adapters/active_record/{join_dependency.rb → join_dependency_extensions.rb} +1 -1
- data/lib/squeel/adapters/active_record/{preloader.rb → preloader_extensions.rb} +1 -1
- data/lib/squeel/adapters/active_record/{relation.rb → relation_extensions.rb} +1 -1
- data/lib/squeel/context.rb +9 -1
- data/lib/squeel/dsl.rb +19 -1
- data/lib/squeel/nodes.rb +1 -0
- data/lib/squeel/nodes/sifter.rb +14 -0
- data/lib/squeel/version.rb +1 -1
- data/lib/squeel/visitors/attribute_visitor.rb +2 -2
- data/lib/squeel/visitors/predicate_visitor.rb +15 -4
- data/lib/squeel/visitors/symbol_visitor.rb +2 -2
- data/lib/squeel/visitors/{base.rb → visitor.rb} +2 -2
- data/spec/helpers/squeel_helper.rb +4 -0
- data/spec/squeel/adapters/active_record/base_extensions_spec.rb +45 -0
- data/spec/squeel/adapters/active_record/{join_dependency_spec.rb → join_dependency_extensions_spec.rb} +1 -1
- data/spec/squeel/adapters/active_record/{relation_spec.rb → relation_extensions_spec.rb} +1 -1
- data/spec/squeel/dsl_spec.rb +14 -0
- data/spec/squeel/nodes/sifter_spec.rb +22 -0
- data/spec/squeel/visitors/predicate_visitor_spec.rb +18 -0
- data/spec/support/schema.rb +5 -0
- metadata +32 -26
data/README.md
CHANGED
@@ -266,6 +266,54 @@ I'm not sure about you, but I much prefer the latter. In short, you can add `_an
|
|
266
266
|
`_all` to any predicate method, and it would do what you expect, when given an array of
|
267
267
|
possibilities to compare against.
|
268
268
|
|
269
|
+
### Sifters
|
270
|
+
|
271
|
+
Sifters are like little snippets of conditions that take parameters. Let's say that you
|
272
|
+
have a model called Article, and you often want to query for articles that contain a
|
273
|
+
string in the title or body. So you write a scope:
|
274
|
+
|
275
|
+
def self.title_or_body_contains(string)
|
276
|
+
where{title.matches("%#{string}%") | body.matches("%#{string}%")}
|
277
|
+
end
|
278
|
+
|
279
|
+
But then you want to query for people who wrote an article that matches these conditions,
|
280
|
+
but the scope only works against the model where it was defined. So instead, you write a
|
281
|
+
sifter:
|
282
|
+
|
283
|
+
class Article < ActiveRecord::Base
|
284
|
+
sifter :title_or_body_contains do |string|
|
285
|
+
title.matches("%#{string}%") | body.matches("%#{string}%")
|
286
|
+
end
|
287
|
+
end
|
288
|
+
|
289
|
+
Now you can write...
|
290
|
+
|
291
|
+
Article.where{sift :title_or_body_contains, 'awesome'}
|
292
|
+
=> SELECT "articles".* FROM "articles"
|
293
|
+
WHERE ((
|
294
|
+
"articles"."title" LIKE '%awesome%'
|
295
|
+
OR "articles"."body" LIKE '%awesome%'
|
296
|
+
))
|
297
|
+
|
298
|
+
... or ...
|
299
|
+
|
300
|
+
Person.joins(:articles).
|
301
|
+
where{
|
302
|
+
{articles => sift(:title_or_body_contains, 'awesome')}
|
303
|
+
}
|
304
|
+
# => SELECT "people".* FROM "people"
|
305
|
+
INNER JOIN "articles" ON "articles"."person_id" = "people"."id"
|
306
|
+
WHERE ((
|
307
|
+
"articles"."title" LIKE '%awesome%'
|
308
|
+
OR "articles"."body" LIKE '%awesome%'
|
309
|
+
))
|
310
|
+
|
311
|
+
Or, you can just modify your previous scope, changing `where` to `squeel`:
|
312
|
+
|
313
|
+
def self.title_or_body_contains(string)
|
314
|
+
squeel{title.matches("%#{string}%") | body.matches("%#{string}%")}
|
315
|
+
end
|
316
|
+
|
269
317
|
### Subqueries
|
270
318
|
|
271
319
|
You can supply an `ActiveRecord::Relation` as a value for a predicate in order to use
|
@@ -1,26 +1,28 @@
|
|
1
1
|
case ActiveRecord::VERSION::MAJOR
|
2
2
|
when 3
|
3
3
|
ActiveRecord::Relation.send :include, Squeel::Nodes::Aliasing
|
4
|
-
require 'squeel/adapters/active_record/
|
4
|
+
require 'squeel/adapters/active_record/join_dependency_extensions'
|
5
|
+
require 'squeel/adapters/active_record/base_extensions'
|
6
|
+
ActiveRecord::Base.extend Squeel::Adapters::ActiveRecord::BaseExtensions
|
5
7
|
|
6
8
|
case ActiveRecord::VERSION::MINOR
|
7
9
|
when 0
|
8
10
|
require 'squeel/adapters/active_record/3.0/compat'
|
9
|
-
require 'squeel/adapters/active_record/3.0/
|
10
|
-
require 'squeel/adapters/active_record/3.0/
|
11
|
+
require 'squeel/adapters/active_record/3.0/relation_extensions'
|
12
|
+
require 'squeel/adapters/active_record/3.0/association_preload_extensions'
|
11
13
|
require 'squeel/adapters/active_record/3.0/context'
|
12
14
|
|
13
|
-
ActiveRecord::Relation.send :include, Squeel::Adapters::ActiveRecord::
|
14
|
-
ActiveRecord::Associations::ClassMethods::JoinDependency.send :include, Squeel::Adapters::ActiveRecord::
|
15
|
-
ActiveRecord::Base.extend Squeel::Adapters::ActiveRecord::
|
15
|
+
ActiveRecord::Relation.send :include, Squeel::Adapters::ActiveRecord::RelationExtensions
|
16
|
+
ActiveRecord::Associations::ClassMethods::JoinDependency.send :include, Squeel::Adapters::ActiveRecord::JoinDependencyExtensions
|
17
|
+
ActiveRecord::Base.extend Squeel::Adapters::ActiveRecord::AssociationPreloadExtensions
|
16
18
|
else
|
17
|
-
require 'squeel/adapters/active_record/
|
18
|
-
require 'squeel/adapters/active_record/
|
19
|
+
require 'squeel/adapters/active_record/relation_extensions'
|
20
|
+
require 'squeel/adapters/active_record/preloader_extensions'
|
19
21
|
require 'squeel/adapters/active_record/context'
|
20
22
|
|
21
|
-
ActiveRecord::Relation.send :include, Squeel::Adapters::ActiveRecord::
|
22
|
-
ActiveRecord::Associations::JoinDependency.send :include, Squeel::Adapters::ActiveRecord::
|
23
|
-
ActiveRecord::Associations::Preloader.send :include, Squeel::Adapters::ActiveRecord::
|
23
|
+
ActiveRecord::Relation.send :include, Squeel::Adapters::ActiveRecord::RelationExtensions
|
24
|
+
ActiveRecord::Associations::JoinDependency.send :include, Squeel::Adapters::ActiveRecord::JoinDependencyExtensions
|
25
|
+
ActiveRecord::Associations::Preloader.send :include, Squeel::Adapters::ActiveRecord::PreloaderExtensions
|
24
26
|
end
|
25
27
|
else
|
26
28
|
raise NotImplementedError, "Squeel does not support ActiveRecord version #{ActiveRecord::VERSION::STRING}"
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module Squeel
|
2
2
|
module Adapters
|
3
3
|
module ActiveRecord
|
4
|
-
module
|
4
|
+
module AssociationPreloadExtensions
|
5
5
|
|
6
6
|
def preload_associations(records, associations, preload_options={})
|
7
7
|
super(records, Visitors::SymbolVisitor.new.accept(associations), preload_options)
|
@@ -60,6 +60,16 @@ module Squeel
|
|
60
60
|
end
|
61
61
|
end
|
62
62
|
|
63
|
+
def classify(object)
|
64
|
+
if Class === object
|
65
|
+
object
|
66
|
+
elsif object.respond_to? :active_record
|
67
|
+
object.active_record
|
68
|
+
else
|
69
|
+
raise ArgumentError, "#{object} can't be converted to a class"
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
63
73
|
end
|
64
74
|
end
|
65
75
|
end
|
@@ -3,7 +3,7 @@ require 'active_record'
|
|
3
3
|
module Squeel
|
4
4
|
module Adapters
|
5
5
|
module ActiveRecord
|
6
|
-
module
|
6
|
+
module RelationExtensions
|
7
7
|
|
8
8
|
JoinAssociation = ::ActiveRecord::Associations::ClassMethods::JoinDependency::JoinAssociation
|
9
9
|
JoinDependency = ::ActiveRecord::Associations::ClassMethods::JoinDependency
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Squeel
|
2
|
+
module Adapters
|
3
|
+
module ActiveRecord
|
4
|
+
module BaseExtensions
|
5
|
+
|
6
|
+
def squeel(&block)
|
7
|
+
DSL.eval &block
|
8
|
+
end
|
9
|
+
|
10
|
+
def sifter(name = nil)
|
11
|
+
if Symbol === name && block_given?
|
12
|
+
singleton_class.send :define_method, name,
|
13
|
+
lambda {|*args| DSL.exec(*args, &Proc.new)}
|
14
|
+
else
|
15
|
+
raise ArgumentError, "A name and block are required"
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -60,6 +60,16 @@ module Squeel
|
|
60
60
|
end
|
61
61
|
end
|
62
62
|
|
63
|
+
def classify(object)
|
64
|
+
if Class === object
|
65
|
+
object
|
66
|
+
elsif object.respond_to? :active_record
|
67
|
+
object.active_record
|
68
|
+
else
|
69
|
+
raise ArgumentError, "#{object} can't be converted to a class"
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
63
73
|
end
|
64
74
|
end
|
65
75
|
end
|
@@ -3,7 +3,7 @@ require 'active_record'
|
|
3
3
|
module Squeel
|
4
4
|
module Adapters
|
5
5
|
module ActiveRecord
|
6
|
-
module
|
6
|
+
module RelationExtensions
|
7
7
|
|
8
8
|
JoinAssociation = ::ActiveRecord::Associations::JoinDependency::JoinAssociation
|
9
9
|
JoinDependency = ::ActiveRecord::Associations::JoinDependency
|
data/lib/squeel/context.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'arel'
|
2
2
|
|
3
3
|
module Squeel
|
4
|
-
# @abstract Subclass and implement {#traverse}, #
|
4
|
+
# @abstract Subclass and implement {#traverse}, {#find} and {#get_table}
|
5
5
|
# to create a Context that supports a given ORM.
|
6
6
|
class Context
|
7
7
|
attr_reader :base, :engine, :arel_visitor
|
@@ -63,5 +63,13 @@ module Squeel
|
|
63
63
|
raise NotImplementedError, "Subclasses must implement private method get_table"
|
64
64
|
end
|
65
65
|
|
66
|
+
# Returns a class for the corresponding object.
|
67
|
+
#
|
68
|
+
# @param object A classifiable object (this will depend on the subclass's implementation)
|
69
|
+
# @return [Class] The class corresponding to the object
|
70
|
+
def classify(object)
|
71
|
+
raise NotImplementedError, "Subclasses must implement private method classify"
|
72
|
+
end
|
73
|
+
|
66
74
|
end
|
67
75
|
end
|
data/lib/squeel/dsl.rb
CHANGED
@@ -6,7 +6,7 @@ module Squeel
|
|
6
6
|
# method calls to fall through to method_missing.
|
7
7
|
Squeel.evil_things do
|
8
8
|
(instance_methods + private_instance_methods).each do |method|
|
9
|
-
unless method.to_s =~ /^(__|instance_eval)/
|
9
|
+
unless method.to_s =~ /^(__|instance_eval|instance_exec)/
|
10
10
|
undef_method method
|
11
11
|
end
|
12
12
|
end
|
@@ -32,6 +32,14 @@ module Squeel
|
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
35
|
+
# Called from an adapter, not directly.
|
36
|
+
# Executes a block of Squeel DSL code, possibly with arguments.
|
37
|
+
#
|
38
|
+
# @return The results of the executed DSL code.
|
39
|
+
def self.exec(*args, &block)
|
40
|
+
self.new(block.binding).instance_exec(*args, &block)
|
41
|
+
end
|
42
|
+
|
35
43
|
private
|
36
44
|
|
37
45
|
# This isn't normally called directly, but via DSL.eval, which will
|
@@ -63,6 +71,16 @@ module Squeel
|
|
63
71
|
Nodes::Literal.new(string)
|
64
72
|
end
|
65
73
|
|
74
|
+
# Create a Squeel Sifter node. This essentially substitutes the
|
75
|
+
# sifter block of the supplied name from the model.
|
76
|
+
#
|
77
|
+
# @param [Symbol, Nodes::Stub] name The name of the sifter defined in the model.
|
78
|
+
# @return [Nodes::Sifter] The sifter node
|
79
|
+
def sift(name, *args)
|
80
|
+
name = name.to_sym if Nodes::Stub === name
|
81
|
+
Nodes::Sifter.new name, args
|
82
|
+
end
|
83
|
+
|
66
84
|
# Node generation inside DSL blocks.
|
67
85
|
#
|
68
86
|
# @overload node_name
|
data/lib/squeel/nodes.rb
CHANGED
data/lib/squeel/version.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
|
-
require 'squeel/visitors/
|
1
|
+
require 'squeel/visitors/visitor'
|
2
2
|
|
3
3
|
module Squeel
|
4
4
|
module Visitors
|
5
5
|
# A visitor that tries to convert visited nodes into Arel::Attributes
|
6
6
|
# or other nodes that can be used for grouping, ordering, and the like.
|
7
|
-
class AttributeVisitor <
|
7
|
+
class AttributeVisitor < Visitor
|
8
8
|
|
9
9
|
private
|
10
10
|
|
@@ -1,8 +1,8 @@
|
|
1
|
-
require 'squeel/visitors/
|
1
|
+
require 'squeel/visitors/visitor'
|
2
2
|
|
3
3
|
module Squeel
|
4
4
|
module Visitors
|
5
|
-
class PredicateVisitor <
|
5
|
+
class PredicateVisitor < Visitor
|
6
6
|
|
7
7
|
TRUE_SQL = Arel.sql('1=1').freeze
|
8
8
|
FALSE_SQL = Arel.sql('1=0').freeze
|
@@ -83,6 +83,17 @@ module Squeel
|
|
83
83
|
Arel.sql(o.expr)
|
84
84
|
end
|
85
85
|
|
86
|
+
# Visit a Squeel sifter by executing its corresponding constraint block
|
87
|
+
# in the parent's class, with its given arguments, then visiting the result.
|
88
|
+
#
|
89
|
+
# @param [Nodes::Sifter] o The Sifter to visit
|
90
|
+
# @param parent The parent object in the context
|
91
|
+
# @return The result of visiting the executed block's return value
|
92
|
+
def visit_Squeel_Nodes_Sifter(o, parent)
|
93
|
+
klass = classify(parent)
|
94
|
+
visit(klass.send(o.name, *o.args), parent)
|
95
|
+
end
|
96
|
+
|
86
97
|
# Visit a Squeel predicate, converting it into an ARel predicate
|
87
98
|
#
|
88
99
|
# @param [Nodes::Predicate] o The predicate to visit
|
@@ -220,7 +231,7 @@ module Squeel
|
|
220
231
|
# @param v The value to consider
|
221
232
|
def implies_context_change?(v)
|
222
233
|
case v
|
223
|
-
when Hash, Nodes::Predicate, Nodes::Unary, Nodes::Binary, Nodes::Nary
|
234
|
+
when Hash, Nodes::Predicate, Nodes::Unary, Nodes::Binary, Nodes::Nary, Nodes::Sifter
|
224
235
|
true
|
225
236
|
when Nodes::KeyPath
|
226
237
|
can_visit?(v.endpoint) && !(Nodes::Stub === v.endpoint)
|
@@ -245,7 +256,7 @@ module Squeel
|
|
245
256
|
end
|
246
257
|
|
247
258
|
case v
|
248
|
-
when Hash, Nodes::KeyPath, Nodes::Predicate, Nodes::Unary, Nodes::Binary, Nodes::Nary
|
259
|
+
when Hash, Nodes::KeyPath, Nodes::Predicate, Nodes::Unary, Nodes::Binary, Nodes::Nary, Nodes::Sifter
|
249
260
|
visit(v, parent || k)
|
250
261
|
when Array
|
251
262
|
v.map {|val| visit(val, parent || k)}
|
@@ -4,9 +4,9 @@ require 'squeel/nodes'
|
|
4
4
|
module Squeel
|
5
5
|
module Visitors
|
6
6
|
# The Base visitor class, containing the default behavior common to subclasses.
|
7
|
-
class
|
7
|
+
class Visitor
|
8
8
|
attr_accessor :context
|
9
|
-
delegate :contextualize, :find, :traverse, :engine, :arel_visitor, :to => :context
|
9
|
+
delegate :contextualize, :classify, :find, :traverse, :engine, :arel_visitor, :to => :context
|
10
10
|
|
11
11
|
# Create a new Visitor that uses the supplied context object to contextualize
|
12
12
|
# visited nodes.
|
@@ -0,0 +1,45 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Squeel
|
4
|
+
module Adapters
|
5
|
+
module ActiveRecord
|
6
|
+
describe BaseExtensions do
|
7
|
+
|
8
|
+
subject { Person }
|
9
|
+
|
10
|
+
it { should respond_to :sifter }
|
11
|
+
|
12
|
+
describe '#sifter' do
|
13
|
+
|
14
|
+
subject { Article }
|
15
|
+
|
16
|
+
specify { expect {subject.sifter 'blah'}.to raise_error ArgumentError }
|
17
|
+
|
18
|
+
context 'with a sifter defned via block' do
|
19
|
+
before :all do
|
20
|
+
subject.sifter :title_or_body_contains do |value|
|
21
|
+
(title =~ "%#{value}%") | (body =~ "%#{value}%")
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
it { should respond_to :title_or_body_contains }
|
26
|
+
specify { subject.title_or_body_contains('ernie').should be_a Nodes::Or }
|
27
|
+
end
|
28
|
+
|
29
|
+
context 'with a sifter defined via method' do
|
30
|
+
before :all do
|
31
|
+
def subject.title_starts_with(val)
|
32
|
+
squeel{title =~ "#{val}%"}
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
it { should respond_to :title_starts_with }
|
37
|
+
specify { subject.title_starts_with('ernie').should be_a Nodes::Predicate }
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
data/spec/squeel/dsl_spec.rb
CHANGED
@@ -96,5 +96,19 @@ module Squeel
|
|
96
96
|
end
|
97
97
|
end
|
98
98
|
|
99
|
+
describe '#sift' do
|
100
|
+
it 'creates a Sifter' do
|
101
|
+
result = dsl{sift :blah}
|
102
|
+
result.should be_a Nodes::Sifter
|
103
|
+
result.name.should eq :blah
|
104
|
+
end
|
105
|
+
|
106
|
+
it 'casts Stubs to Symbols for sifter names' do
|
107
|
+
result = dsl{sift blah}
|
108
|
+
result.should be_a Nodes::Sifter
|
109
|
+
result.name.should eq :blah
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
99
113
|
end
|
100
114
|
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Squeel
|
4
|
+
module Nodes
|
5
|
+
describe Sifter do
|
6
|
+
|
7
|
+
subject { Sifter.new :title_or_body_contains, ['awesome'] }
|
8
|
+
|
9
|
+
specify { subject.name.should eq :title_or_body_contains }
|
10
|
+
specify { subject.args.should eq ['awesome'] }
|
11
|
+
|
12
|
+
it { should respond_to :& }
|
13
|
+
it { should respond_to :| }
|
14
|
+
it { should respond_to :-@ }
|
15
|
+
|
16
|
+
specify { (subject & subject).should be_a And }
|
17
|
+
specify { (subject | subject).should be_a Or }
|
18
|
+
specify { (-subject).should be_a Not }
|
19
|
+
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -248,6 +248,24 @@ module Squeel
|
|
248
248
|
predicate.to_sql.should match /"people"."name" = "children_people"."name"/
|
249
249
|
end
|
250
250
|
|
251
|
+
it 'visits Squeel Sifters at top level' do
|
252
|
+
predicate = @v.accept(dsl {sift :name_starts_or_ends_with, 'smith'})
|
253
|
+
predicate.should be_a Arel::Nodes::Grouping
|
254
|
+
expr = predicate.expr
|
255
|
+
expr.should be_a Arel::Nodes::Or
|
256
|
+
expr.left.to_sql.should match /"people"."name" LIKE 'smith%'/
|
257
|
+
expr.right.to_sql.should match /"people"."name" LIKE '%smith'/
|
258
|
+
end
|
259
|
+
|
260
|
+
it 'visits nested Squeel sifters' do
|
261
|
+
predicate = @v.accept(dsl {{:children => sift(:name_starts_or_ends_with, 'smith')}})
|
262
|
+
predicate.should be_a Arel::Nodes::Grouping
|
263
|
+
expr = predicate.expr
|
264
|
+
expr.should be_a Arel::Nodes::Or
|
265
|
+
expr.left.to_sql.should match /"children_people"."name" LIKE 'smith%'/
|
266
|
+
expr.right.to_sql.should match /"children_people"."name" LIKE '%smith'/
|
267
|
+
end
|
268
|
+
|
251
269
|
it 'honors an explicit table in string keys' do
|
252
270
|
predicate = @v.accept('things.attribute' => 'retro')
|
253
271
|
predicate.should be_a Arel::Nodes::Equality
|
data/spec/support/schema.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'active_record'
|
2
|
+
require 'squeel'
|
2
3
|
|
3
4
|
ActiveRecord::Base.establish_connection(
|
4
5
|
:adapter => 'sqlite3',
|
@@ -19,6 +20,10 @@ class Person < ActiveRecord::Base
|
|
19
20
|
|
20
21
|
has_many :outgoing_messages, :class_name => 'Message', :foreign_key => :author_id
|
21
22
|
has_many :incoming_messages, :class_name => 'Message', :foreign_key => :recipient_id
|
23
|
+
|
24
|
+
sifter :name_starts_or_ends_with do |value|
|
25
|
+
(name =~ "#{value}%") | (name =~ "%#{value}")
|
26
|
+
end
|
22
27
|
end
|
23
28
|
|
24
29
|
class PersonWithNamePrimaryKey < ActiveRecord::Base
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: squeel
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.9.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-09-
|
12
|
+
date: 2011-09-07 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activerecord
|
16
|
-
requirement: &
|
16
|
+
requirement: &70114561715900 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '3.0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70114561715900
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: activesupport
|
27
|
-
requirement: &
|
27
|
+
requirement: &70114561714720 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '3.0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70114561714720
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: polyamorous
|
38
|
-
requirement: &
|
38
|
+
requirement: &70114561713420 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: 0.5.0
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70114561713420
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: rspec
|
49
|
-
requirement: &
|
49
|
+
requirement: &70114561712440 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ~>
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: 2.6.0
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70114561712440
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: machinist
|
60
|
-
requirement: &
|
60
|
+
requirement: &70114561710960 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ~>
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: 1.0.6
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *70114561710960
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: faker
|
71
|
-
requirement: &
|
71
|
+
requirement: &70114561710220 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ~>
|
@@ -76,10 +76,10 @@ dependencies:
|
|
76
76
|
version: 0.9.5
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *70114561710220
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: sqlite3
|
82
|
-
requirement: &
|
82
|
+
requirement: &70114561709220 !ruby/object:Gem::Requirement
|
83
83
|
none: false
|
84
84
|
requirements:
|
85
85
|
- - ~>
|
@@ -87,7 +87,7 @@ dependencies:
|
|
87
87
|
version: 1.3.3
|
88
88
|
type: :development
|
89
89
|
prerelease: false
|
90
|
-
version_requirements: *
|
90
|
+
version_requirements: *70114561709220
|
91
91
|
description: ! "\n Squeel unlocks the power of ARel in your Rails 3 application
|
92
92
|
with\n a handy block-based syntax. You can write subqueries, access named\n
|
93
93
|
\ functions provided by your RDBMS, and more, all without writing\n SQL
|
@@ -109,14 +109,15 @@ files:
|
|
109
109
|
- lib/core_ext/symbol.rb
|
110
110
|
- lib/squeel.rb
|
111
111
|
- lib/squeel/adapters/active_record.rb
|
112
|
-
- lib/squeel/adapters/active_record/3.0/
|
112
|
+
- lib/squeel/adapters/active_record/3.0/association_preload_extensions.rb
|
113
113
|
- lib/squeel/adapters/active_record/3.0/compat.rb
|
114
114
|
- lib/squeel/adapters/active_record/3.0/context.rb
|
115
|
-
- lib/squeel/adapters/active_record/3.0/
|
115
|
+
- lib/squeel/adapters/active_record/3.0/relation_extensions.rb
|
116
|
+
- lib/squeel/adapters/active_record/base_extensions.rb
|
116
117
|
- lib/squeel/adapters/active_record/context.rb
|
117
|
-
- lib/squeel/adapters/active_record/
|
118
|
-
- lib/squeel/adapters/active_record/
|
119
|
-
- lib/squeel/adapters/active_record/
|
118
|
+
- lib/squeel/adapters/active_record/join_dependency_extensions.rb
|
119
|
+
- lib/squeel/adapters/active_record/preloader_extensions.rb
|
120
|
+
- lib/squeel/adapters/active_record/relation_extensions.rb
|
120
121
|
- lib/squeel/configuration.rb
|
121
122
|
- lib/squeel/constants.rb
|
122
123
|
- lib/squeel/context.rb
|
@@ -138,15 +139,16 @@ files:
|
|
138
139
|
- lib/squeel/nodes/order.rb
|
139
140
|
- lib/squeel/nodes/predicate.rb
|
140
141
|
- lib/squeel/nodes/predicate_operators.rb
|
142
|
+
- lib/squeel/nodes/sifter.rb
|
141
143
|
- lib/squeel/nodes/stub.rb
|
142
144
|
- lib/squeel/nodes/unary.rb
|
143
145
|
- lib/squeel/predicate_methods.rb
|
144
146
|
- lib/squeel/version.rb
|
145
147
|
- lib/squeel/visitors.rb
|
146
148
|
- lib/squeel/visitors/attribute_visitor.rb
|
147
|
-
- lib/squeel/visitors/base.rb
|
148
149
|
- lib/squeel/visitors/predicate_visitor.rb
|
149
150
|
- lib/squeel/visitors/symbol_visitor.rb
|
151
|
+
- lib/squeel/visitors/visitor.rb
|
150
152
|
- spec/blueprints/articles.rb
|
151
153
|
- spec/blueprints/comments.rb
|
152
154
|
- spec/blueprints/notes.rb
|
@@ -156,9 +158,10 @@ files:
|
|
156
158
|
- spec/core_ext/symbol_spec.rb
|
157
159
|
- spec/helpers/squeel_helper.rb
|
158
160
|
- spec/spec_helper.rb
|
161
|
+
- spec/squeel/adapters/active_record/base_extensions_spec.rb
|
159
162
|
- spec/squeel/adapters/active_record/context_spec.rb
|
160
|
-
- spec/squeel/adapters/active_record/
|
161
|
-
- spec/squeel/adapters/active_record/
|
163
|
+
- spec/squeel/adapters/active_record/join_dependency_extensions_spec.rb
|
164
|
+
- spec/squeel/adapters/active_record/relation_extensions_spec.rb
|
162
165
|
- spec/squeel/core_ext/symbol_spec.rb
|
163
166
|
- spec/squeel/dsl_spec.rb
|
164
167
|
- spec/squeel/nodes/function_spec.rb
|
@@ -170,6 +173,7 @@ files:
|
|
170
173
|
- spec/squeel/nodes/order_spec.rb
|
171
174
|
- spec/squeel/nodes/predicate_operators_spec.rb
|
172
175
|
- spec/squeel/nodes/predicate_spec.rb
|
176
|
+
- spec/squeel/nodes/sifter_spec.rb
|
173
177
|
- spec/squeel/nodes/stub_spec.rb
|
174
178
|
- spec/squeel/visitors/attribute_visitor_spec.rb
|
175
179
|
- spec/squeel/visitors/predicate_visitor_spec.rb
|
@@ -223,9 +227,10 @@ test_files:
|
|
223
227
|
- spec/core_ext/symbol_spec.rb
|
224
228
|
- spec/helpers/squeel_helper.rb
|
225
229
|
- spec/spec_helper.rb
|
230
|
+
- spec/squeel/adapters/active_record/base_extensions_spec.rb
|
226
231
|
- spec/squeel/adapters/active_record/context_spec.rb
|
227
|
-
- spec/squeel/adapters/active_record/
|
228
|
-
- spec/squeel/adapters/active_record/
|
232
|
+
- spec/squeel/adapters/active_record/join_dependency_extensions_spec.rb
|
233
|
+
- spec/squeel/adapters/active_record/relation_extensions_spec.rb
|
229
234
|
- spec/squeel/core_ext/symbol_spec.rb
|
230
235
|
- spec/squeel/dsl_spec.rb
|
231
236
|
- spec/squeel/nodes/function_spec.rb
|
@@ -237,6 +242,7 @@ test_files:
|
|
237
242
|
- spec/squeel/nodes/order_spec.rb
|
238
243
|
- spec/squeel/nodes/predicate_operators_spec.rb
|
239
244
|
- spec/squeel/nodes/predicate_spec.rb
|
245
|
+
- spec/squeel/nodes/sifter_spec.rb
|
240
246
|
- spec/squeel/nodes/stub_spec.rb
|
241
247
|
- spec/squeel/visitors/attribute_visitor_spec.rb
|
242
248
|
- spec/squeel/visitors/predicate_visitor_spec.rb
|