rusql 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rusql/basic_condition.rb +13 -2
- data/lib/rusql/complex_condition.rb +4 -2
- data/lib/rusql/query.rb +1 -1
- data/lib/rusql/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1ff1b4a10ef306cabe203f2af5da46b99e11b1f6
|
4
|
+
data.tar.gz: cece6f6999111a263632519870d48bd54f9d3a63
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dfd7287e5e4040c15ba79c2ce96d259b722b7825c3604b4dace91f95fa9c627958186571416cbd4ccf04bd36bb43efd26b4b801d2d0f02469d151acae331be46
|
7
|
+
data.tar.gz: 9ffb4d54d0cae07c5de2f8cdd67380fc46b4559a6b217cdf4ff6f0e836b9300ab83808ce32b1d140ae35eeb3e902129c1e129699e89222c34d42c6ce69cd5214
|
@@ -23,7 +23,7 @@ module Rusql
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def and(condition)
|
26
|
-
raise
|
26
|
+
raise TypeException.new(Condition, condition.class) unless condition.is_a?(Condition)
|
27
27
|
|
28
28
|
c = ComplexCondition.new
|
29
29
|
c.type = :and
|
@@ -33,7 +33,18 @@ module Rusql
|
|
33
33
|
c
|
34
34
|
end
|
35
35
|
|
36
|
-
def
|
36
|
+
def or(condition)
|
37
|
+
raise TypeException.new(Condition, condition.class) unless condition.is_a?(Condition)
|
38
|
+
|
39
|
+
c = ComplexCondition.new
|
40
|
+
c.type = :or
|
41
|
+
c.add_condition(self)
|
42
|
+
c.add_condition(condition)
|
43
|
+
|
44
|
+
c
|
45
|
+
end
|
46
|
+
|
47
|
+
def to_s(indent_level: 1) # to make it compatible with complex condition to_s
|
37
48
|
case self.type
|
38
49
|
when :equals
|
39
50
|
"#{left.to_s} = #{convert_value(self.right)}"
|
@@ -56,8 +56,10 @@ module Rusql
|
|
56
56
|
new_condition
|
57
57
|
end
|
58
58
|
|
59
|
-
def to_s(
|
60
|
-
|
59
|
+
def to_s(indent_level: 1)
|
60
|
+
indent = " "*indent_level
|
61
|
+
indent_out = " "*(indent_level-1)
|
62
|
+
"(\n" + indent + self.conditions.map{ |c| c.to_s(indent_level: indent_level+1) }.join("\n#{indent}#{self.type.to_s.upcase} ") + "\n#{indent_out})"
|
61
63
|
end
|
62
64
|
end
|
63
65
|
end
|
data/lib/rusql/query.rb
CHANGED
data/lib/rusql/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rusql
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ajith Hussain
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-07-
|
11
|
+
date: 2016-07-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|