flounder 0.15.0 → 0.15.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9f4ec6bd3fa4f14eccf7efa8d3aed4e81a3d8e08
4
- data.tar.gz: cba009f5dc2b519b4636b643b7ac1d02bd9a493c
3
+ metadata.gz: f116f6520c4017a543634696a1d98c17cf3208d9
4
+ data.tar.gz: 9471a11ee88f27827a3c6ac3ecdeea6218c5b0b2
5
5
  SHA512:
6
- metadata.gz: 81a859be8701dc7aa497f17949ed8bb8db93cb22daaba9c24796d5d225ef4cfd936174f132648bde9755d67b4aa15c92db2c09e404fec28280e4db62d3fa302b
7
- data.tar.gz: 85f24647fe87ddd7a788df1f0722811fd828d4e0c5c570c6ac295e40d9ef6d4e5fb3ead5526a20bf35566f2132638c7b355ba0e1291697e79c20f8c63a6d9c38
6
+ metadata.gz: 2746df8286f4a3d5068e482321e556581778fb96acba83d1c89cae63dfa76846f8e7abcbadd43e2d59b6b5edc8a44e144a2b439176e4d8c484eb00e7c20e7f1f
7
+ data.tar.gz: 45eb6fa78492db34ed608b1f45a9490a626dda10c4912366fd1dd1420f7f515d5c7bc4902e35c03432470d8ddc7607714c98e1ae188ba017239539fefeea5e51
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "flounder"
5
- s.version = '0.15.0'
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"
@@ -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(
@@ -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
+ ~~~
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flounder
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.15.0
4
+ version: 0.15.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kaspar Schiess