csdl 0.2.0 → 0.2.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/lib/csdl/builder.rb +34 -7
- data/lib/csdl/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: 135ecbcd588b93734289488616a6da8e47933dc3
|
4
|
+
data.tar.gz: 21e8f7d9fa247a9aecaae66c710cc0a85c07608f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7d8499b0904fa8ce5da292cb8f9704407235549e4fd8052105883dce5a59bd3fcf067a82cbc77ca286b6fd25751139b6f610fc0ade7b0725c234601a52f363c8
|
7
|
+
data.tar.gz: 7977cd29e77bc3e548a7019df211b063e218cf345d7ed4f3ce1dcde20f31be29b74422d851ae811156a808f144f4279d459e89f0533328f842601b76ccbe794f
|
data/lib/csdl/builder.rb
CHANGED
@@ -39,7 +39,14 @@ module CSDL
|
|
39
39
|
# @see #logical_group
|
40
40
|
#
|
41
41
|
def _and(&block)
|
42
|
-
|
42
|
+
children = __one_or_more_child_nodes(&block)
|
43
|
+
if children.empty?
|
44
|
+
nil
|
45
|
+
elsif children.size == 1
|
46
|
+
children.first
|
47
|
+
else
|
48
|
+
s(:and, *children)
|
49
|
+
end
|
43
50
|
end
|
44
51
|
|
45
52
|
# Negate a condition. Analogous to {#condition} with NOT prepended to the condition.
|
@@ -89,7 +96,14 @@ module CSDL
|
|
89
96
|
# @see #logical_group
|
90
97
|
#
|
91
98
|
def _or(&block)
|
92
|
-
|
99
|
+
children = __one_or_more_child_nodes(&block)
|
100
|
+
if children.empty?
|
101
|
+
nil
|
102
|
+
elsif children.size == 1
|
103
|
+
children.first
|
104
|
+
else
|
105
|
+
s(:or, *children)
|
106
|
+
end
|
93
107
|
end
|
94
108
|
|
95
109
|
# Wrap child nodes in a return statement scope.
|
@@ -215,10 +229,13 @@ module CSDL
|
|
215
229
|
# @see #_or
|
216
230
|
#
|
217
231
|
def logical_group(logical_operator = nil, &block)
|
232
|
+
children = __one_or_more_child_nodes(&block)
|
233
|
+
return nil if children.empty?
|
234
|
+
|
218
235
|
if logical_operator.nil?
|
219
|
-
s(:logical_group, *
|
236
|
+
s(:logical_group, *children)
|
220
237
|
else
|
221
|
-
s(:logical_group, s(logical_operator, *
|
238
|
+
s(:logical_group, s(logical_operator, *children))
|
222
239
|
end
|
223
240
|
end
|
224
241
|
|
@@ -251,7 +268,12 @@ module CSDL
|
|
251
268
|
# @see #tag_tree
|
252
269
|
#
|
253
270
|
def root(&block)
|
254
|
-
|
271
|
+
children = __one_or_more_child_nodes(&block)
|
272
|
+
if children.empty?
|
273
|
+
nil
|
274
|
+
else
|
275
|
+
s(:root, *children)
|
276
|
+
end
|
255
277
|
end
|
256
278
|
|
257
279
|
# Wrap child nodes in braces. @note Generally not useful on its own, see {#_return}, {#tag}, or {#tag_tree} usage.
|
@@ -274,7 +296,12 @@ module CSDL
|
|
274
296
|
# @see #tag_tree
|
275
297
|
#
|
276
298
|
def statement_scope(&block)
|
277
|
-
|
299
|
+
children = __one_or_more_child_nodes(&block)
|
300
|
+
if children.empty?
|
301
|
+
nil
|
302
|
+
else
|
303
|
+
s(:statement_scope, *children)
|
304
|
+
end
|
278
305
|
end
|
279
306
|
|
280
307
|
# Wrap child nodes in a VEDO tag classification.
|
@@ -340,7 +367,7 @@ module CSDL
|
|
340
367
|
|
341
368
|
def __one_or_more_child_nodes(&block)
|
342
369
|
children = instance_eval(&block)
|
343
|
-
[ children ].flatten
|
370
|
+
[ children ].flatten.compact
|
344
371
|
end
|
345
372
|
|
346
373
|
end
|
data/lib/csdl/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: csdl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- BJ Neilsen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-06-
|
11
|
+
date: 2015-06-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ast
|