rusql 1.0.3 → 1.0.4
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/lib/rusql/join.rb +4 -2
- data/lib/rusql/query.rb +4 -2
- data/lib/rusql/version.rb +1 -1
- 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: 7de70ccbf6676684b58192eeb8801799bc4b045d
|
4
|
+
data.tar.gz: 67a793c131ce5ca49d099d8bbccccda3f8e5f9da
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 344a891cb2325191454bc29d05f18f963a17dbad7aad7e3875ab43cca71ab1512ca530a4a2ad8509301bdd48b98dbcddffb2a5b5a5889798ace858aa6636b87e
|
7
|
+
data.tar.gz: db12ee071da15bb594a64724cf72c3922c4df3f8ec0a3aed7f2e8ae44afa34df6bf9cf1dcae77479308d57bf954b6ba5a244476febd839b159c42e9ba88db7c0
|
data/lib/rusql/join.rb
CHANGED
@@ -11,12 +11,14 @@ module Rusql
|
|
11
11
|
)
|
12
12
|
|
13
13
|
def initialize(type, table, condition)
|
14
|
+
final_table = table.is_a?(Table) ? table : ( table.respond_to?(:as_rusql_table) ? table.as_rusql_table : nil )
|
15
|
+
|
14
16
|
raise Exception.new("Expected type to be one of #{ TYPES.map(&:to_s).join(",") }") unless TYPES.include?(type)
|
15
|
-
raise TypeException.new(Table, table.class)
|
17
|
+
raise TypeException.new(Table, table.class) if final_table.nil?
|
16
18
|
raise TypeException.new(BasicCondition, condition.class) unless condition.is_a?(BasicCondition)
|
17
19
|
|
18
20
|
@type = type
|
19
|
-
@table =
|
21
|
+
@table = final_table
|
20
22
|
@condition = condition
|
21
23
|
end
|
22
24
|
|
data/lib/rusql/query.rb
CHANGED
@@ -44,10 +44,12 @@ module Rusql
|
|
44
44
|
end
|
45
45
|
|
46
46
|
def from(t)
|
47
|
-
|
47
|
+
# so that we can have ActiveRecord hacks :/
|
48
|
+
final_table = t.is_a?(Table) ? t : ( t.respond_to?(:as_rusql_table) ? t.as_rusql_table : nil )
|
49
|
+
raise TypeException.new(Table, t.class) if final_table.nil?
|
48
50
|
|
49
51
|
new_one = self.duplicate
|
50
|
-
new_one.instance_variable_set(:@from_table,
|
52
|
+
new_one.instance_variable_set(:@from_table, final_table)
|
51
53
|
|
52
54
|
new_one
|
53
55
|
end
|
data/lib/rusql/version.rb
CHANGED