flounder 0.15.0 → 0.15.1
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.
- checksums.yaml +4 -4
- data/flounder.gemspec +1 -1
- data/lib/flounder/query/base.rb +9 -0
- data/qed/expressions.md +7 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f116f6520c4017a543634696a1d98c17cf3208d9
|
4
|
+
data.tar.gz: 9471a11ee88f27827a3c6ac3ecdeea6218c5b0b2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2746df8286f4a3d5068e482321e556581778fb96acba83d1c89cae63dfa76846f8e7abcbadd43e2d59b6b5edc8a44e144a2b439176e4d8c484eb00e7c20e7f1f
|
7
|
+
data.tar.gz: 45eb6fa78492db34ed608b1f45a9490a626dda10c4912366fd1dd1420f7f515d5c7bc4902e35c03432470d8ddc7607714c98e1ae188ba017239539fefeea5e51
|
data/flounder.gemspec
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = "flounder"
|
5
|
-
s.version = '0.15.
|
5
|
+
s.version = '0.15.1'
|
6
6
|
s.summary = "Flounder is a way to write SQL simply in Ruby. It deals with everything BUT object relational mapping. "
|
7
7
|
s.email = "kaspar.schiess@technologyastronauts.ch"
|
8
8
|
s.homepage = "https://bitbucket.org/technologyastronauts/oss_flounder"
|
data/lib/flounder/query/base.rb
CHANGED
@@ -109,6 +109,15 @@ module Flounder::Query
|
|
109
109
|
return self
|
110
110
|
end
|
111
111
|
|
112
|
+
# or maybe this is a Flounder::Expression::Expr?
|
113
|
+
if conditions.size == 1 && conditions.first.kind_of?(Flounder::Expression::Expr)
|
114
|
+
condition = conditions.first
|
115
|
+
apply.call(
|
116
|
+
Arel::Nodes::SqlLiteral.new(condition.to_sql))
|
117
|
+
|
118
|
+
return self
|
119
|
+
end
|
120
|
+
|
112
121
|
# maybe conditions is of the second form?
|
113
122
|
conditions.each do |cond_str, *values|
|
114
123
|
apply.call(
|
data/qed/expressions.md
CHANGED
@@ -15,3 +15,10 @@ You can also pass a condition-like hash to expr directly, it will return a Ruby
|
|
15
15
|
(users.cond(:posts, a: 1) | users.cond(a: 2)).
|
16
16
|
assert generates_sql("((\"posts\".\"a\" = 1) OR (\"users\".\"a\" = 2))")
|
17
17
|
~~~
|
18
|
+
|
19
|
+
These condition pieces can be used in a WHERE-clause directly.
|
20
|
+
|
21
|
+
~~~ruby
|
22
|
+
users.where(users.cond(id: 1)).
|
23
|
+
assert generates_sql("SELECT [fields] FROM \"users\" WHERE (\"users\".\"id\" = 1)")
|
24
|
+
~~~
|