grumlin 0.13.1 → 0.14.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/main.yml +1 -1
- data/.rspec +0 -1
- data/.rubocop.yml +1 -1
- data/.tool-versions +1 -1
- data/CHANGELOG.md +7 -0
- data/Gemfile.lock +6 -1
- data/grumlin.gemspec +1 -1
- data/lib/grumlin/anonymous_step.rb +12 -6
- data/lib/grumlin/bytecode.rb +8 -3
- data/lib/grumlin/expressions/u.rb +2 -2
- data/lib/grumlin/shortcut_proxy.rb +4 -4
- data/lib/grumlin/shortcuts/properties.rb +2 -2
- data/lib/grumlin/step.rb +4 -4
- data/lib/grumlin/traversal.rb +16 -3
- data/lib/grumlin/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e353294814ba425473eb717892ea994d686dd25eec4db78cd0c15102f68a7e53
|
4
|
+
data.tar.gz: 672458be5666e00f34386e632a8a902e3271ad91160b1b2d4bd2235d3789abd9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cc64a8dacf4dc2384e0d3da380cb0b62f534e603e49f67f537f0c1e46feb549c8098d8580c1d9d96edf0f3b145b777ae26206025086e52ee86ca37e526d53f8a
|
7
|
+
data.tar.gz: 4c2ae1909426dc7c89a41feecb2e7a917daa33f8adb7330229691fa7e49585b1b1e24fca7773026e998f7a738b701d8457e50fcaf8ca3c9e271a71b698ea26e6
|
data/.github/workflows/main.yml
CHANGED
data/.rspec
CHANGED
data/.rubocop.yml
CHANGED
data/.tool-versions
CHANGED
@@ -1 +1 @@
|
|
1
|
-
ruby 2.
|
1
|
+
ruby 2.7.5
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
## [0.14.0] - 2021-12-07
|
2
|
+
|
3
|
+
- Add initial support for [configuration steps](https://tinkerpop.apache.org/docs/current/reference/#configuration-steps)
|
4
|
+
- Add the `withSideEffect` configuration step
|
5
|
+
- Fix passing keyword arguments to regular steps
|
6
|
+
- *Drop support for ruby 2.6*
|
7
|
+
|
1
8
|
## [0.13.0] - 2021-12-03
|
2
9
|
|
3
10
|
- Add `Shortcuts` and `Repository`
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
grumlin (0.
|
4
|
+
grumlin (0.14.0)
|
5
5
|
async-pool (~> 0.3)
|
6
6
|
async-websocket (~> 0.19)
|
7
7
|
oj (~> 3.12)
|
@@ -60,8 +60,12 @@ GEM
|
|
60
60
|
rexml
|
61
61
|
kramdown-parser-gfm (1.1.0)
|
62
62
|
kramdown (~> 2.0)
|
63
|
+
mini_portile2 (2.5.3)
|
63
64
|
minitest (5.14.4)
|
64
65
|
nio4r (2.5.8)
|
66
|
+
nokogiri (1.11.7)
|
67
|
+
mini_portile2 (~> 2.5.0)
|
68
|
+
racc (~> 1.4)
|
65
69
|
nokogiri (1.11.7-x86_64-linux)
|
66
70
|
racc (~> 1.4)
|
67
71
|
oj (3.13.9)
|
@@ -154,6 +158,7 @@ GEM
|
|
154
158
|
zeitwerk (2.4.2)
|
155
159
|
|
156
160
|
PLATFORMS
|
161
|
+
ruby
|
157
162
|
x86_64-linux
|
158
163
|
|
159
164
|
DEPENDENCIES
|
data/grumlin.gemspec
CHANGED
@@ -16,7 +16,7 @@ Gem::Specification.new do |spec|
|
|
16
16
|
|
17
17
|
spec.homepage = "https://github.com/zhulik/grumlin"
|
18
18
|
spec.license = "MIT"
|
19
|
-
spec.required_ruby_version = Gem::Requirement.new(">= 2.
|
19
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 2.7.0")
|
20
20
|
|
21
21
|
spec.metadata["homepage_uri"] = spec.homepage
|
22
22
|
spec.metadata["source_code_uri"] = "https://github.com/zhulik/grumlin"
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
module Grumlin
|
4
4
|
class AnonymousStep
|
5
|
-
attr_reader :name, :
|
5
|
+
attr_reader :name, :previous_step, :configuration_steps
|
6
6
|
|
7
7
|
# TODO: add other steps
|
8
8
|
SUPPORTED_STEPS = %i[E V addE addV and as both bothE by coalesce count dedup drop elementMap emit fold from group
|
@@ -10,20 +10,22 @@ module Grumlin
|
|
10
10
|
project property range repeat select sideEffect skip tail to unfold union until valueMap
|
11
11
|
values where with].freeze
|
12
12
|
|
13
|
-
def initialize(name, *args, previous_step: nil)
|
13
|
+
def initialize(name, *args, configuration_steps: [], previous_step: nil, **params)
|
14
14
|
@name = name
|
15
15
|
@previous_step = previous_step
|
16
16
|
@args = args
|
17
|
+
@params = params
|
18
|
+
@configuration_steps = configuration_steps
|
17
19
|
end
|
18
20
|
|
19
21
|
SUPPORTED_STEPS.each do |step|
|
20
|
-
define_method(step) do |*args|
|
21
|
-
step(step, args)
|
22
|
+
define_method(step) do |*args, **params|
|
23
|
+
step(step, *args, **params)
|
22
24
|
end
|
23
25
|
end
|
24
26
|
|
25
|
-
def step(name, args)
|
26
|
-
self.class.new(name, *args, previous_step: self)
|
27
|
+
def step(name, *args, **params)
|
28
|
+
self.class.new(name, *args, previous_step: self, configuration_steps: configuration_steps, **params)
|
27
29
|
end
|
28
30
|
|
29
31
|
def inspect
|
@@ -35,5 +37,9 @@ module Grumlin
|
|
35
37
|
def bytecode(no_return: false)
|
36
38
|
@bytecode ||= Bytecode.new(self, no_return: no_return)
|
37
39
|
end
|
40
|
+
|
41
|
+
def args
|
42
|
+
[*@args, @params.any? ? arg.params : nil].compact
|
43
|
+
end
|
38
44
|
end
|
39
45
|
end
|
data/lib/grumlin/bytecode.rb
CHANGED
@@ -20,7 +20,10 @@ module Grumlin
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def inspect
|
23
|
-
|
23
|
+
configuration_steps = @step.configuration_steps.map do |s|
|
24
|
+
serialize_arg(s, serialization_method: :to_readable_bytecode)
|
25
|
+
end
|
26
|
+
"#{configuration_steps.any? ? configuration_steps : nil}#{to_readable_bytecode}"
|
24
27
|
end
|
25
28
|
alias to_s inspect
|
26
29
|
|
@@ -29,13 +32,15 @@ module Grumlin
|
|
29
32
|
end
|
30
33
|
|
31
34
|
def value
|
32
|
-
{ step: (steps + (@no_return ? [NONE_STEP] : [])).map { |s| serialize_arg(s) } }
|
35
|
+
@value ||= { step: (steps + (@no_return ? [NONE_STEP] : [])).map { |s| serialize_arg(s) } }.tap do |v|
|
36
|
+
v.merge!(source: @step.configuration_steps.map { |s| serialize_arg(s) }) if @step.configuration_steps.any?
|
37
|
+
end
|
33
38
|
end
|
34
39
|
|
35
40
|
private
|
36
41
|
|
37
42
|
# Serializes step or a step argument to either an executable query or a human readable string representation
|
38
|
-
# depending on the `serialization_method` parameter.
|
43
|
+
# depending on the `serialization_method` parameter. It should be either `:to_readable_bytecode` for human readable
|
39
44
|
# representation or `:to_bytecode` for query.
|
40
45
|
def serialize_arg(arg, serialization_method: :to_bytecode)
|
41
46
|
return arg.public_send(serialization_method) if arg.respond_to?(serialization_method)
|
@@ -13,12 +13,12 @@ module Grumlin
|
|
13
13
|
@parent = parent
|
14
14
|
end
|
15
15
|
|
16
|
-
def method_missing(name, *args)
|
17
|
-
return @parent.public_send(name, *args) if %i[__ g].include?(name) && !@parent.nil?
|
16
|
+
def method_missing(name, *args, **params)
|
17
|
+
return @parent.public_send(name, *args, **params) if %i[__ g].include?(name) && !@parent.nil?
|
18
18
|
|
19
|
-
return wrap_result(@object.public_send(name, *args)) if @object.respond_to?(name)
|
19
|
+
return wrap_result(@object.public_send(name, *args, **params)) if @object.respond_to?(name)
|
20
20
|
|
21
|
-
return wrap_result(instance_exec(*args, &@shortcuts[name])) if @shortcuts.key?(name)
|
21
|
+
return wrap_result(instance_exec(*args, **params, &@shortcuts[name])) if @shortcuts.key?(name)
|
22
22
|
|
23
23
|
super
|
24
24
|
end
|
@@ -5,13 +5,13 @@ module Grumlin
|
|
5
5
|
module Properties
|
6
6
|
extend Grumlin::Shortcuts
|
7
7
|
|
8
|
-
shortcut :props do
|
8
|
+
shortcut :props do |*_args, **props|
|
9
9
|
props.reduce(self) do |tt, (prop, value)|
|
10
10
|
tt.property(prop, value)
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
14
|
-
shortcut :hasAll do
|
14
|
+
shortcut :hasAll do |*, **props|
|
15
15
|
props.reduce(self) do |tt, (prop, value)|
|
16
16
|
tt.has(prop, value)
|
17
17
|
end
|
data/lib/grumlin/step.rb
CHANGED
@@ -4,8 +4,8 @@ module Grumlin
|
|
4
4
|
class Step < AnonymousStep
|
5
5
|
attr_reader :client
|
6
6
|
|
7
|
-
def initialize(pool, name, *args, previous_step: nil)
|
8
|
-
super(name, *args, previous_step: previous_step)
|
7
|
+
def initialize(pool, name, *args, configuration_steps: [], previous_step: nil, **params)
|
8
|
+
super(name, *args, previous_step: previous_step, configuration_steps: configuration_steps, **params)
|
9
9
|
@pool = pool
|
10
10
|
end
|
11
11
|
|
@@ -36,8 +36,8 @@ module Grumlin
|
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
39
|
-
def step(step_name, args)
|
40
|
-
self.class.new(@pool, step_name, *args, previous_step: self)
|
39
|
+
def step(step_name, *args, **params)
|
40
|
+
self.class.new(@pool, step_name, *args, previous_step: self, configuration_steps: @configuration_steps, **params)
|
41
41
|
end
|
42
42
|
end
|
43
43
|
end
|
data/lib/grumlin/traversal.rb
CHANGED
@@ -5,13 +5,26 @@ module Grumlin
|
|
5
5
|
# TODO: add other start steps
|
6
6
|
SUPPORTED_STEPS = %i[E V addE addV].freeze
|
7
7
|
|
8
|
-
|
8
|
+
CONFIGURATION_STEPS = %i[withSideEffect].freeze
|
9
|
+
|
10
|
+
attr_reader :configuration_steps
|
11
|
+
|
12
|
+
def initialize(pool = Grumlin.default_pool, configuration_steps: [])
|
9
13
|
@pool = pool
|
14
|
+
@configuration_steps = configuration_steps
|
15
|
+
end
|
16
|
+
|
17
|
+
alias inspect to_s
|
18
|
+
|
19
|
+
CONFIGURATION_STEPS.each do |step|
|
20
|
+
define_method step do |*args, **params|
|
21
|
+
self.class.new(@pool, configuration_steps: @configuration_steps + [AnonymousStep.new(step, *args, **params)])
|
22
|
+
end
|
10
23
|
end
|
11
24
|
|
12
25
|
SUPPORTED_STEPS.each do |step|
|
13
|
-
define_method step do |*args|
|
14
|
-
Step.new(@pool, step, *args)
|
26
|
+
define_method step do |*args, **params|
|
27
|
+
Step.new(@pool, step, *args, configuration_steps: @configuration_steps, **params)
|
15
28
|
end
|
16
29
|
end
|
17
30
|
end
|
data/lib/grumlin/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: grumlin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.14.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gleb Sinyavskiy
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-12-
|
11
|
+
date: 2021-12-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: async-pool
|
@@ -141,7 +141,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
141
141
|
requirements:
|
142
142
|
- - ">="
|
143
143
|
- !ruby/object:Gem::Version
|
144
|
-
version: 2.
|
144
|
+
version: 2.7.0
|
145
145
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
146
146
|
requirements:
|
147
147
|
- - ">="
|