ciql 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ciql/sanitize.rb +6 -2
- data/lib/ciql/version.rb +1 -1
- data/spec/ciql/client/binary_spec.rb +1 -1
- data/spec/ciql/client/thrift_spec.rb +1 -1
- data/spec/ciql/sanitize_spec.rb +11 -6
- metadata +11 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d970154542794f5068a3eb1c3db01626c0043dac
|
4
|
+
data.tar.gz: 6fa0c48171ecbcb7eaadf406612a556ea181474d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f8617949842428fab81a257d449b7e48c2cf56e5f4babc0f5b53860a8c3d0b7413fd69472f018b247eb30dad144305014a462495d5e02c37df91838806cf0957
|
7
|
+
data.tar.gz: 16e5a590c5820eba2909d849a57c87e629bbac5d7a84421aa62b41b1227f2350d48636441d1f04ac161fa5ff4e4daeb12ee6936ea941c780b5a900aad94e4ead
|
data/lib/ciql/sanitize.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'simple_uuid'
|
2
|
+
require 'set'
|
2
3
|
|
3
4
|
module Ciql
|
4
5
|
module Sanitize
|
@@ -29,10 +30,13 @@ module Ciql
|
|
29
30
|
def self.cast(obj)
|
30
31
|
case obj
|
31
32
|
when Hash
|
32
|
-
obj.map { |pair| pair.map(&method(:cast)).join(':') }.join(',')
|
33
|
+
"{#{obj.map { |pair| pair.map(&method(:cast)).join(':') }.join(',')}}"
|
34
|
+
|
35
|
+
when Set
|
36
|
+
"{#{obj.map { |member| cast(member) }.join(',')}}"
|
33
37
|
|
34
38
|
when Enumerable
|
35
|
-
obj.map { |member| cast(member) }.join(',')
|
39
|
+
"[#{obj.map { |member| cast(member) }.join(',')}]"
|
36
40
|
|
37
41
|
when NilClass then 'NULL'
|
38
42
|
when Numeric then obj
|
data/lib/ciql/version.rb
CHANGED
data/spec/ciql/sanitize_spec.rb
CHANGED
@@ -85,19 +85,24 @@ module Ciql
|
|
85
85
|
end
|
86
86
|
|
87
87
|
it 'converts TrueClass instances to true, without quotes' do
|
88
|
-
subject.sanitize('?',
|
88
|
+
subject.sanitize('?', true).should == 'true'
|
89
89
|
end
|
90
90
|
|
91
91
|
it 'converts FalseClass instances to false, without quotes' do
|
92
|
-
subject.sanitize('?',
|
92
|
+
subject.sanitize('?', false).should == 'false'
|
93
93
|
end
|
94
94
|
|
95
|
-
it 'joins elements of an array with a comma separator' do
|
96
|
-
subject.sanitize('?', [1,
|
95
|
+
it 'joins casted elements of an array with a comma separator wrapped in []' do
|
96
|
+
subject.sanitize('?', [1,true,Time.at(0).to_date])
|
97
|
+
.should == "[1,true,'1969-12-31']"
|
97
98
|
end
|
98
99
|
|
99
|
-
it 'joins
|
100
|
-
subject.sanitize('?',
|
100
|
+
it 'joins casted elements of a set with a comma separator wrapped in {}' do
|
101
|
+
subject.sanitize('?', [1,nil,'a'].to_set).should == "{1,NULL,'a'}"
|
102
|
+
end
|
103
|
+
|
104
|
+
it 'joins casted key/value pairs of a hash with colon and comma separators wrapped in {}' do
|
105
|
+
subject.sanitize('?', {a: 1, b: 'z'}).should == "{'a':1,'b':'z'}"
|
101
106
|
end
|
102
107
|
end
|
103
108
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ciql
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Justin Bradford
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-12-
|
11
|
+
date: 2013-12-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cql-rb
|
@@ -16,42 +16,42 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ~>
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 1.1.
|
19
|
+
version: 1.1.2
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ~>
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 1.1.
|
26
|
+
version: 1.1.2
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: simple_uuid
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - ~>
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
34
|
-
type: :
|
33
|
+
version: 0.4.0
|
34
|
+
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - ~>
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: 0.4.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: cassandra-cql
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - ~>
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
47
|
+
version: 1.2.1
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - ~>
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
54
|
+
version: 1.2.1
|
55
55
|
description: A CQL-based Cassandra client for Ruby
|
56
56
|
email:
|
57
57
|
- justin@nulu.com
|