aql 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +4 -0
- data/.rspec +1 -0
- data/.travis.yml +18 -0
- data/Gemfile +6 -0
- data/Gemfile.devtools +64 -0
- data/Guardfile +18 -0
- data/LICENSE +20 -0
- data/README.md +86 -0
- data/Rakefile +2 -0
- data/TODO +1 -0
- data/aql.gemspec +23 -0
- data/config/flay.yml +3 -0
- data/config/flog.yml +2 -0
- data/config/mutant.yml +3 -0
- data/config/roodi.yml +18 -0
- data/config/site.reek +100 -0
- data/config/yardstick.yml +2 -0
- data/examples/aql.rb +31 -0
- data/lib/aql.rb +62 -0
- data/lib/aql/buffer.rb +129 -0
- data/lib/aql/constants.rb +19 -0
- data/lib/aql/node.rb +45 -0
- data/lib/aql/node/attribute.rb +25 -0
- data/lib/aql/node/block.rb +28 -0
- data/lib/aql/node/call.rb +83 -0
- data/lib/aql/node/literal.rb +48 -0
- data/lib/aql/node/literal/composed.rb +10 -0
- data/lib/aql/node/literal/composed/document.rb +59 -0
- data/lib/aql/node/literal/composed/list.rb +42 -0
- data/lib/aql/node/literal/primitive.rb +10 -0
- data/lib/aql/node/literal/primitive/number.rb +28 -0
- data/lib/aql/node/literal/primitive/string.rb +27 -0
- data/lib/aql/node/literal/singleton.rb +51 -0
- data/lib/aql/node/name.rb +31 -0
- data/lib/aql/node/null.rb +21 -0
- data/lib/aql/node/operation.rb +20 -0
- data/lib/aql/node/operation/binary.rb +33 -0
- data/lib/aql/node/operation/for.rb +77 -0
- data/lib/aql/node/operation/limit.rb +42 -0
- data/lib/aql/node/operation/nary.rb +57 -0
- data/lib/aql/node/operation/unary.rb +75 -0
- data/lib/aql/node/operator.rb +20 -0
- data/lib/aql/node/operator/assignment.rb +28 -0
- data/lib/aql/node/operator/binary.rb +92 -0
- data/lib/aql/node/operator/nary.rb +48 -0
- data/lib/aql/node/operator/ternary.rb +30 -0
- data/lib/aql/node/operator/unary.rb +39 -0
- data/spec/shared/aql_behavior.rb +7 -0
- data/spec/spec_helper.rb +11 -0
- data/spec/support/aql_helper.rb +12 -0
- data/spec/unit/aql/buffer/append_spec.rb +59 -0
- data/spec/unit/aql/buffer/binary_spec.rb +22 -0
- data/spec/unit/aql/buffer/class_methods/utf8_encode_spec.rb +21 -0
- data/spec/unit/aql/buffer/content_spec.rb +24 -0
- data/spec/unit/aql/buffer/delimited_spec.rb +31 -0
- data/spec/unit/aql/buffer/parentheses_spec.rb +33 -0
- data/spec/unit/aql/buffer/wrap_delimited_spec.rb +42 -0
- data/spec/unit/aql/class_methods/literal_node_spec.rb +15 -0
- data/spec/unit/aql/class_methods/name_node_spec.rb +19 -0
- data/spec/unit/aql/node/attribute/aql_spec.rb +22 -0
- data/spec/unit/aql/node/block/aql_spec.rb +28 -0
- data/spec/unit/aql/node/call/aql_spec.rb +39 -0
- data/spec/unit/aql/node/literal/class_methods/build_spec.rb +139 -0
- data/spec/unit/aql/node/literal/class_methods/construct_spec.rb +16 -0
- data/spec/unit/aql/node/literal/class_methods/handle_spec.rb +22 -0
- data/spec/unit/aql/node/literal/composed/document/aql_spec.rb +32 -0
- data/spec/unit/aql/node/literal/composed/document/attribute/aql_spec.rb +15 -0
- data/spec/unit/aql/node/literal/composed/document/class_methods/construct_spec.rb +24 -0
- data/spec/unit/aql/node/literal/composed/list/aql_spec.rb +20 -0
- data/spec/unit/aql/node/literal/composed/list/class_methods/construct_spec.rb +37 -0
- data/spec/unit/aql/node/literal/primitive/number/aql_spec.rb +23 -0
- data/spec/unit/aql/node/literal/primitive/string/aql_spec.rb +21 -0
- data/spec/unit/aql/node/literal/singleton/aql_spec.rb +14 -0
- data/spec/unit/aql/node/literal/singleton/class_methods/construct_spec.rb +30 -0
- data/spec/unit/aql/node/name/aql_spec.rb +33 -0
- data/spec/unit/aql/node/null/aql_spec.rb +7 -0
- data/spec/unit/aql/node/operation/binary/let/aql_spec.rb +10 -0
- data/spec/unit/aql/node/operation/for/aql_spec.rb +18 -0
- data/spec/unit/aql/node/operation/keyword_spec.rb +16 -0
- data/spec/unit/aql/node/operation/limit/aql_spec.rb +19 -0
- data/spec/unit/aql/node/operation/nary/aql_spec.rb +16 -0
- data/spec/unit/aql/node/operation/nary/collect/into/aql_spec.rb +11 -0
- data/spec/unit/aql/node/operation/nary/sort/aql_spec.rb +22 -0
- data/spec/unit/aql/node/operation/unary/aql_spec.rb +12 -0
- data/spec/unit/aql/node/operation/unary/direction/aql_spec.rb +14 -0
- data/spec/unit/aql/node/operation/unary/filter/aql_spec.rb +20 -0
- data/spec/unit/aql/node/operation/unary/return/aql_spec.rb +17 -0
- data/spec/unit/aql/node/operator/assignment/aql_spec.rb +10 -0
- data/spec/unit/aql/node/operator/binary/aql_spec.rb +15 -0
- data/spec/unit/aql/node/operator/nary/aql_spec.rb +31 -0
- data/spec/unit/aql/node/operator/operator_spec.rb +18 -0
- data/spec/unit/aql/node/operator/ternary/aql_spec.rb +12 -0
- data/spec/unit/aql/node/operator/unary/aql_spec.rb +12 -0
- data/spec/unit/aql/node/visit_spec.rb +27 -0
- metadata +262 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 831cd3ea9ec7a3ae864fa6f3579481602b4f323a
|
4
|
+
data.tar.gz: ddfb790665d03384c0defee6d89f40114feed595
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 61895ff8f2d104ac0d092a0a236d6926be791585f0aec9592dfd70d1b50e6dab80bebd635782f5692171194e77d40ddfb1a103a57569848bb3c43736505e2e89
|
7
|
+
data.tar.gz: c7afee1e4caed51811e269d4af0674e50af5f1eae56772b79fed0eb4d847826f896b2289fc8bf8c7dc1113951fec8170f293a813cae84685ea429676e52a10e6
|
data/.gitignore
ADDED
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--color
|
data/.travis.yml
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
language: ruby
|
2
|
+
script: 'bundle exec rake ci'
|
3
|
+
rvm:
|
4
|
+
- ree
|
5
|
+
- 1.8.7
|
6
|
+
- 1.9.2
|
7
|
+
- 1.9.3
|
8
|
+
- 2.0.0
|
9
|
+
- ruby-head
|
10
|
+
- jruby-18mode
|
11
|
+
- jruby-19mode
|
12
|
+
- jruby-head
|
13
|
+
- rbx-18mode
|
14
|
+
- rbx-19mode
|
15
|
+
notifications:
|
16
|
+
irc: "irc.freenode.org#datamapper"
|
17
|
+
email:
|
18
|
+
- mbj@seonic.net
|
data/Gemfile
ADDED
data/Gemfile.devtools
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
group :development do
|
4
|
+
gem 'rake', '~> 10.0.3'
|
5
|
+
gem 'rspec', '~> 2.13.0'
|
6
|
+
gem 'yard', '~> 0.8.5'
|
7
|
+
end
|
8
|
+
|
9
|
+
group :yard do
|
10
|
+
gem 'kramdown', '~> 0.14.2'
|
11
|
+
end
|
12
|
+
|
13
|
+
group :guard do
|
14
|
+
gem 'guard', '~> 1.6.2'
|
15
|
+
gem 'guard-bundler', '~> 1.0.0'
|
16
|
+
gem 'guard-rspec', '~> 2.4.1'
|
17
|
+
|
18
|
+
# file system change event handling
|
19
|
+
gem 'rb-fchange', '~> 0.0.6', :require => false
|
20
|
+
gem 'rb-fsevent', '~> 0.9.3', :require => false
|
21
|
+
gem 'rb-inotify', '~> 0.9.0', :require => false
|
22
|
+
|
23
|
+
gem 'listen', '~> 0.7.3'
|
24
|
+
|
25
|
+
# notification handling
|
26
|
+
gem 'libnotify', '~> 0.8.0', :require => false
|
27
|
+
gem 'rb-notifu', '~> 0.0.4', :require => false
|
28
|
+
gem 'terminal-notifier-guard', '~> 1.5.3', :require => false
|
29
|
+
end
|
30
|
+
|
31
|
+
group :metrics do
|
32
|
+
gem 'flay', '~> 2.1.0'
|
33
|
+
gem 'flog', '~> 3.2.2'
|
34
|
+
gem 'reek', '~> 1.3.1'
|
35
|
+
gem 'metric_fu-roodi', '~> 2.2.1'
|
36
|
+
gem 'yardstick', '~> 0.9.4'
|
37
|
+
|
38
|
+
platforms :ruby_18, :ruby_19 do
|
39
|
+
# this indirectly depends on ffi which does not build on ruby-head
|
40
|
+
gem 'yard-spellcheck', '~> 0.1.5'
|
41
|
+
end
|
42
|
+
|
43
|
+
platforms :mri_19, :rbx do
|
44
|
+
gem 'mutant', '~> 0.2.20'
|
45
|
+
end
|
46
|
+
|
47
|
+
platforms :mri_19 do
|
48
|
+
gem 'simplecov', '~> 0.7.1'
|
49
|
+
end
|
50
|
+
|
51
|
+
platforms :rbx do
|
52
|
+
gem 'pelusa', '~> 0.2.2'
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
group :benchmarks do
|
57
|
+
gem 'rbench', '~> 0.2.3'
|
58
|
+
end
|
59
|
+
|
60
|
+
platform :jruby do
|
61
|
+
group :jruby do
|
62
|
+
gem 'jruby-openssl', '~> 0.8.2'
|
63
|
+
end
|
64
|
+
end
|
data/Guardfile
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
guard :bundler do
|
4
|
+
watch('Gemfile')
|
5
|
+
end
|
6
|
+
|
7
|
+
guard :rspec, :all_on_start => false, :all_after_pass => false do
|
8
|
+
# run all specs if the spec_helper or supporting files files are modified
|
9
|
+
watch('spec/spec_helper.rb') { 'spec/unit' }
|
10
|
+
watch(%r{\Aspec/(?:lib|support|shared)/.+\.rb\z}) { 'spec/unit' }
|
11
|
+
|
12
|
+
# run unit specs if associated lib code is modified
|
13
|
+
watch(%r{\Alib/(.+)\.rb\z}) { |m| Dir["spec/unit/#{m[1]}"] }
|
14
|
+
watch("lib/#{File.basename(File.expand_path('../', __FILE__))}.rb") { 'spec/unit' }
|
15
|
+
|
16
|
+
# run a spec if it is modified
|
17
|
+
watch(%r{\Aspec/(?:unit|integration)/.+_spec\.rb\z})
|
18
|
+
end
|
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2013 Markus Schirp
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,86 @@
|
|
1
|
+
AQL
|
2
|
+
===
|
3
|
+
|
4
|
+
[![Build Status](https://secure.travis-ci.org/mbj/aql.png?branch=master)](http://travis-ci.org/mbj/aql)
|
5
|
+
[![Dependency Status](https://gemnasium.com/mbj/aql.png)](https://gemnasium.com/mbj/aql)
|
6
|
+
[![Code Climate](https://codeclimate.com/github/mbj/aql.png)](https://codeclimate.com/github/mbj/aql)
|
7
|
+
|
8
|
+
Generator for the ArangoDB Query Language [AQL](http://www.arangodb.org/manuals/current/Aql.html) in Ruby. It is used as a backend for [axiom-arango-adapter](https://github.com/mbj/axiom-arango-adapter).
|
9
|
+
|
10
|
+
Using AQL
|
11
|
+
---------
|
12
|
+
|
13
|
+
There is currently no stable public API.
|
14
|
+
|
15
|
+
Installation
|
16
|
+
------------
|
17
|
+
|
18
|
+
There is currently no gem release. Use git source in your Gemfile:
|
19
|
+
|
20
|
+
```ruby
|
21
|
+
gem 'aql', :git => 'https://github.com/mbj/aql'
|
22
|
+
```
|
23
|
+
|
24
|
+
Or use ```:github => 'mbj/aql'``` if you prefer unencrypted protocols.
|
25
|
+
|
26
|
+
Examples
|
27
|
+
--------
|
28
|
+
|
29
|
+
This gem does not have a public API. Please do not use it as a way to generate AQL statements by hand - this gem is not intended for this purpose. Instead write a library that uses this gem to generate AQL. Just to make it easier for you to get into the code, here is an example on how to generate a simple AQL statement:
|
30
|
+
|
31
|
+
```ruby
|
32
|
+
require 'aql'
|
33
|
+
|
34
|
+
include AQL
|
35
|
+
|
36
|
+
person = Node::Name.new('person')
|
37
|
+
firstname = Node::Name.new('firstname')
|
38
|
+
lastname = Node::Name.new('lastname')
|
39
|
+
|
40
|
+
person_firstname = Node::Attribute.new(person, firstname)
|
41
|
+
|
42
|
+
node = Node::Operation::For.new(
|
43
|
+
person,
|
44
|
+
Node::Name.new('people'),
|
45
|
+
Node::Block.new(
|
46
|
+
[
|
47
|
+
Node::Operation::Unary::Filter.new(
|
48
|
+
Node::Operator::Binary::Equality.new(person_firstname, Node::Literal::Primitive::String.new('Markus'))
|
49
|
+
),
|
50
|
+
Node::Operation::Unary::Return.new(
|
51
|
+
Node::Literal::Primitive::Composed::Document.new([
|
52
|
+
Node::Literal::Composed::Document::Attribute.new(
|
53
|
+
person_firstname,
|
54
|
+
Node::Attribute.new(person, Node::Name.new('lastname'))
|
55
|
+
)
|
56
|
+
])
|
57
|
+
)
|
58
|
+
]
|
59
|
+
)
|
60
|
+
)
|
61
|
+
|
62
|
+
puts node.aql
|
63
|
+
#=> "FOR `person` IN `people` FILTER (`person`.`firstname` == "Markus") RETURN {`person`.`firstname`: `person`.`lastname`}"
|
64
|
+
```
|
65
|
+
|
66
|
+
Credits
|
67
|
+
-------
|
68
|
+
|
69
|
+
* [Markus Schirp (mbj)](https://github.com/mbj) Author
|
70
|
+
* [triAGENS](https://github.com/triAGENS) For sponsoring this work!
|
71
|
+
|
72
|
+
Contributing
|
73
|
+
-------------
|
74
|
+
|
75
|
+
* Fork the project.
|
76
|
+
* Make your feature addition or bug fix.
|
77
|
+
* Add tests for it. This is important so I don't break it in a
|
78
|
+
future version unintentionally.
|
79
|
+
* Commit, do not mess with Rakefile or version
|
80
|
+
(if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
|
81
|
+
* Send me a pull request. Bonus points for topic branches.
|
82
|
+
|
83
|
+
License
|
84
|
+
-------
|
85
|
+
|
86
|
+
This gem is published under the MIT license. See LICENSE file.
|
data/Rakefile
ADDED
data/aql.gemspec
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = 'aql'
|
5
|
+
s.version = '0.0.1'
|
6
|
+
|
7
|
+
s.authors = ['Markus Schirp']
|
8
|
+
s.email = 'mbj@seonic.net'
|
9
|
+
s.summary = 'The ArangoDB AQL AST. Intended for query generation.'
|
10
|
+
s.homepage = 'http://github.com/mbj/aql'
|
11
|
+
s.license = 'MIT'
|
12
|
+
|
13
|
+
s.files = `git ls-files`.split("\n")
|
14
|
+
s.test_files = `git ls-files -- {spec,features}/*`.split("\n")
|
15
|
+
s.require_paths = %w(lib)
|
16
|
+
s.extra_rdoc_files = %w(README.md)
|
17
|
+
|
18
|
+
s.add_dependency('backports', [ '~> 3.0', '>= 3.0.3' ])
|
19
|
+
s.add_dependency('adamantium', '~> 0.0.7')
|
20
|
+
s.add_dependency('equalizer', '~> 0.0.5')
|
21
|
+
s.add_dependency('abstract_type', '~> 0.0.5')
|
22
|
+
s.add_dependency('concord', '~> 0.0.3')
|
23
|
+
end
|
data/config/flay.yml
ADDED
data/config/flog.yml
ADDED
data/config/mutant.yml
ADDED
data/config/roodi.yml
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
---
|
2
|
+
AbcMetricMethodCheck: { score: 11.0 }
|
3
|
+
AssignmentInConditionalCheck: { }
|
4
|
+
CaseMissingElseCheck: { }
|
5
|
+
ClassLineCountCheck: { line_count: 293 }
|
6
|
+
ClassNameCheck: { pattern: !ruby/regexp '/\A(?:[A-Z]+|Or|In|[A-Z][a-z](?:[A-Z]?[a-z])+)\z/' }
|
7
|
+
ClassVariableCheck: { }
|
8
|
+
CyclomaticComplexityBlockCheck: { complexity: 2 }
|
9
|
+
CyclomaticComplexityMethodCheck: { complexity: 4 }
|
10
|
+
EmptyRescueBodyCheck: { }
|
11
|
+
ForLoopCheck: { }
|
12
|
+
# TODO: decrease line_count to 5 to 10
|
13
|
+
MethodLineCountCheck: { line_count: 14 }
|
14
|
+
MethodNameCheck: { pattern: !ruby/regexp '/\A(?:[a-z\d](?:_?[a-z\d])+[?!=]?|\[\]=?|==|<=>|[+*&|-])\z/' }
|
15
|
+
ModuleLineCountCheck: { line_count: 295 }
|
16
|
+
ModuleNameCheck: { pattern: !ruby/regexp '/\A(?:[A-Z]+|[A-Z][a-z](?:[A-Z]?[a-z])+)\z/' }
|
17
|
+
# TODO: decrease parameter_count to 2 or less
|
18
|
+
ParameterNumberCheck: { parameter_count: 3 }
|
data/config/site.reek
ADDED
@@ -0,0 +1,100 @@
|
|
1
|
+
---
|
2
|
+
UnusedParameters:
|
3
|
+
exclude:
|
4
|
+
- AQL::Node#emit
|
5
|
+
UncommunicativeParameterName:
|
6
|
+
accept: []
|
7
|
+
exclude: []
|
8
|
+
enabled: true
|
9
|
+
reject:
|
10
|
+
- !ruby/regexp /^.$/
|
11
|
+
- !ruby/regexp /[0-9]$/
|
12
|
+
- !ruby/regexp /[A-Z]/
|
13
|
+
LargeClass:
|
14
|
+
max_methods: 10
|
15
|
+
exclude: []
|
16
|
+
enabled: true
|
17
|
+
max_instance_variables: 2
|
18
|
+
UncommunicativeMethodName:
|
19
|
+
accept: []
|
20
|
+
exclude: []
|
21
|
+
enabled: true
|
22
|
+
reject:
|
23
|
+
- !ruby/regexp /^[a-z]$/
|
24
|
+
- !ruby/regexp /[0-9]$/
|
25
|
+
- !ruby/regexp /[A-Z]/
|
26
|
+
LongParameterList:
|
27
|
+
max_params: 2
|
28
|
+
exclude:
|
29
|
+
- AQL::Buffer#wrap_delimited # 3 params
|
30
|
+
- AQL::Buffer#binary # 3 params
|
31
|
+
enabled: true
|
32
|
+
overrides: {}
|
33
|
+
FeatureEnvy:
|
34
|
+
exclude:
|
35
|
+
- AQL::Node::Block#emit # Definitive a false positive
|
36
|
+
- AQL::Node::Call#for_argument? # Definitive a false positive
|
37
|
+
enabled: true
|
38
|
+
ClassVariable:
|
39
|
+
exclude: []
|
40
|
+
enabled: true
|
41
|
+
BooleanParameter:
|
42
|
+
exclude: []
|
43
|
+
enabled: true
|
44
|
+
IrresponsibleModule:
|
45
|
+
exclude: []
|
46
|
+
enabled: true
|
47
|
+
UncommunicativeModuleName:
|
48
|
+
accept: []
|
49
|
+
exclude: []
|
50
|
+
enabled: true
|
51
|
+
reject:
|
52
|
+
- !ruby/regexp /^.$/
|
53
|
+
- !ruby/regexp /[0-9]$/
|
54
|
+
NestedIterators:
|
55
|
+
ignore_iterators: []
|
56
|
+
exclude: []
|
57
|
+
enabled: true
|
58
|
+
max_allowed_nesting: 1
|
59
|
+
LongMethod:
|
60
|
+
max_statements: 5
|
61
|
+
exclude:
|
62
|
+
- AQL::Buffer#binary # 6 statements
|
63
|
+
- AQL::Node::Operation::For#emit # 6 statements
|
64
|
+
enabled: true
|
65
|
+
Duplication:
|
66
|
+
allow_calls: []
|
67
|
+
exclude: []
|
68
|
+
enabled: true
|
69
|
+
max_calls: 1
|
70
|
+
UtilityFunction:
|
71
|
+
max_helper_calls: 1
|
72
|
+
exclude: []
|
73
|
+
enabled: true
|
74
|
+
Attribute:
|
75
|
+
exclude: []
|
76
|
+
enabled: false
|
77
|
+
UncommunicativeVariableName:
|
78
|
+
accept: []
|
79
|
+
exclude: []
|
80
|
+
enabled: true
|
81
|
+
reject:
|
82
|
+
- !ruby/regexp /^.$/
|
83
|
+
- !ruby/regexp /[0-9]$/
|
84
|
+
- !ruby/regexp /[A-Z]/
|
85
|
+
SimulatedPolymorphism:
|
86
|
+
exclude: []
|
87
|
+
enabled: true
|
88
|
+
max_ifs: 1
|
89
|
+
DataClump:
|
90
|
+
exclude: []
|
91
|
+
enabled: true
|
92
|
+
max_copies: 1
|
93
|
+
min_clump_size: 3
|
94
|
+
ControlCouple:
|
95
|
+
exclude: []
|
96
|
+
enabled: true
|
97
|
+
LongYieldList:
|
98
|
+
max_params: 1
|
99
|
+
exclude: []
|
100
|
+
enabled: true
|
data/examples/aql.rb
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'aql'
|
2
|
+
|
3
|
+
include AQL
|
4
|
+
|
5
|
+
person = Node::Name.new('person')
|
6
|
+
firstname = Node::Name.new('firstname')
|
7
|
+
lastname = Node::Name.new('lastname')
|
8
|
+
|
9
|
+
person_firstname = Node::Attribute.new(person, firstname)
|
10
|
+
|
11
|
+
node = Node::Operation::For.new(
|
12
|
+
person,
|
13
|
+
Node::Name.new('people'),
|
14
|
+
Node::Block.new(
|
15
|
+
[
|
16
|
+
Node::Operation::Unary::Filter.new(
|
17
|
+
Node::Operator::Binary::Equality.new(person_firstname, Node::Literal::Primitive::String.new('Markus'))
|
18
|
+
),
|
19
|
+
Node::Operation::Unary::Return.new(
|
20
|
+
Node::Literal::Primitive::Composed::Document.new([
|
21
|
+
Node::Literal::Composed::Document::Attribute.new(
|
22
|
+
person_firstname,
|
23
|
+
Node::Attribute.new(person, Node::Name.new('lastname'))
|
24
|
+
)
|
25
|
+
])
|
26
|
+
)
|
27
|
+
]
|
28
|
+
)
|
29
|
+
)
|
30
|
+
|
31
|
+
puts node.aql
|
data/lib/aql.rb
ADDED
@@ -0,0 +1,62 @@
|
|
1
|
+
require 'backports'
|
2
|
+
require 'abstract_type'
|
3
|
+
require 'adamantium'
|
4
|
+
require 'concord'
|
5
|
+
|
6
|
+
# Library namespace
|
7
|
+
module AQL
|
8
|
+
|
9
|
+
# Return AQL node for literal
|
10
|
+
#
|
11
|
+
# @param [Object] value
|
12
|
+
#
|
13
|
+
# @return [AQL::Node::Literal]
|
14
|
+
#
|
15
|
+
# @api private
|
16
|
+
#
|
17
|
+
def self.literal_node(value)
|
18
|
+
AQL::Node::Literal.build(value)
|
19
|
+
end
|
20
|
+
|
21
|
+
# Return AQL name node
|
22
|
+
#
|
23
|
+
# @param [#to_s] name
|
24
|
+
#
|
25
|
+
# @return [AQL::Node::Name]
|
26
|
+
#
|
27
|
+
# @api private
|
28
|
+
#
|
29
|
+
def self.name_node(name)
|
30
|
+
AQL::Node::Name.new(name.to_s)
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
|
35
|
+
require 'aql/buffer'
|
36
|
+
require 'aql/node'
|
37
|
+
require 'aql/constants'
|
38
|
+
require 'aql/node/name'
|
39
|
+
require 'aql/node/call'
|
40
|
+
require 'aql/node/null'
|
41
|
+
require 'aql/node/block'
|
42
|
+
require 'aql/node/attribute'
|
43
|
+
require 'aql/node/literal'
|
44
|
+
require 'aql/node/literal/singleton'
|
45
|
+
require 'aql/node/literal/primitive'
|
46
|
+
require 'aql/node/literal/primitive/string'
|
47
|
+
require 'aql/node/literal/primitive/number'
|
48
|
+
require 'aql/node/literal/composed'
|
49
|
+
require 'aql/node/literal/composed/document'
|
50
|
+
require 'aql/node/literal/composed/list'
|
51
|
+
require 'aql/node/operator'
|
52
|
+
require 'aql/node/operator/assignment'
|
53
|
+
require 'aql/node/operator/binary'
|
54
|
+
require 'aql/node/operator/unary'
|
55
|
+
require 'aql/node/operator/ternary'
|
56
|
+
require 'aql/node/operator/nary'
|
57
|
+
require 'aql/node/operation'
|
58
|
+
require 'aql/node/operation/unary'
|
59
|
+
require 'aql/node/operation/nary'
|
60
|
+
require 'aql/node/operation/binary'
|
61
|
+
require 'aql/node/operation/limit'
|
62
|
+
require 'aql/node/operation/for'
|