csdl 0.2.3 → 0.2.4

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: 17a36950a3d317a812ba35972f6ead5f9cf76331
4
- data.tar.gz: 6cecc20ee1ff98df245222cd8fb784aecaf461eb
3
+ metadata.gz: a07d1fd17e496ce7326c738b32a50857c01cc558
4
+ data.tar.gz: 7a4e3180bb649502a71e27861de8d83b30429a6e
5
5
  SHA512:
6
- metadata.gz: ca5cd3fc97a24e3c0bbcea9dad0effd2bd3ab98bcbafa75d46458a8aa8c357174d1191ba8d5cf7f38b986cd60d26dd14ce5556e6c44b672f09f7be5ffecca71a
7
- data.tar.gz: e6a8d62a7a1f37ca34eb5143b13c04b72a3645b9ac296ed1dae60f34bf25cc546397080e61c8cfae94a9b025eb43040973c274d8b713a71aa97beff73cb23f15
6
+ metadata.gz: 92df59c8a693fbb6dd33add2b3a6266046a437ab7d26597551525e7bf4bcbb8b005698a136590ee370f05c751eb21be9eb782c1fd2fc2b6e073edce237bd0703
7
+ data.tar.gz: 9eb53810c4a36773b2e9eb03ecb5d9a2b4cff8589f0fa01aa3d06dee14efc6678dc5ebd05ba227819717590a61da5ed5f0c5aef88fdb0134e1e7aec54ed144f9
data/lib/csdl/builder.rb CHANGED
@@ -240,6 +240,30 @@ module CSDL
240
240
  end
241
241
  end
242
242
 
243
+ # Create a node to store raw CSDL.
244
+ # @note this method will not implicitly wrap the raw CSDL in any grouping or scope.
245
+ #
246
+ # @example
247
+ # node = CSDL::Builder.new.raw(%q{fb.content contains_any "foo" OR fb.parent.content contains_any "foo"})
248
+ # CSDL::Processor.new.process(node) # => %q{fb.content contains_any "foo" OR fb.parent.content contains_any "foo"}
249
+ #
250
+ # @example Using with other generated nodes (e.g. condition)
251
+ # nodes = CSDL::Builder.new._or do
252
+ # [
253
+ # condition("fb.type", :exists),
254
+ # logical_group { raw(%q{fb.content contains_any "foo" OR fb.parent.content contains_any "foo"}) }
255
+ # ]
256
+ # end
257
+ # CSDL::Processor.new.process(nodes) # => 'fb.type exists OR (fb.content contains_any "foo" OR fb.parent.content contains_any "foo")'
258
+ #
259
+ # @param raw_csdl [#to_s] The raw CSDL to store.
260
+ #
261
+ # @return [AST::Node] An AST :raw node.
262
+ #
263
+ def raw(raw_csdl)
264
+ s(:raw, raw_csdl.to_s)
265
+ end
266
+
243
267
  # Wrap child nodes in a root node. Useful for building CSDL with tagging and a return statement.
244
268
  #
245
269
  # @example
@@ -164,6 +164,22 @@ module CSDL
164
164
  logically_join_nodes("OR", node.children)
165
165
  end
166
166
 
167
+ # Process :raw nodes.
168
+ #
169
+ # @example
170
+ # node = s(:raw, %q{fb.content contains_any "foo" OR fb.parent.content contains_any "foo"})
171
+ # CSDL::Processor.new.process(node) # => 'fb.content contains_any "foo" OR fb.parent.content contains_any "foo"'
172
+ #
173
+ # @param node [AST::Node] The :raw node to be processed.
174
+ #
175
+ # @return [String] The first child node as a string.
176
+ #
177
+ # @todo Raise if the node doesn't have any children.
178
+ #
179
+ def on_raw(node)
180
+ node.children.first.to_s
181
+ end
182
+
167
183
  # Process all child nodes. Useful for grouping child nodes without any syntax introduction.
168
184
  #
169
185
  # @see InteractionFilterProcessor#_return
data/lib/csdl/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module CSDL
2
- VERSION = "0.2.3"
2
+ VERSION = "0.2.4"
3
3
  end
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.3
4
+ version: 0.2.4
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-24 00:00:00.000000000 Z
11
+ date: 2015-07-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ast