grumlin 0.20.1 → 0.20.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f1f9f9d0ec31cd18d6852dc7920ee15de0d4799d229ed7bfa92ee1dccfe48d9d
4
- data.tar.gz: 0fb3bd378cb520ef310c4926c914fd2ddb4dbc1d674ef245a727d4bb776c5164
3
+ metadata.gz: e2a547fb7cbcfe53c2fab5486236b4d1021b8c4fe487307003571b24ea9e04d8
4
+ data.tar.gz: b1f73d016d9779f63a0d19c2c02afc5b975544a479aa9e9a1f5424edfde2911f
5
5
  SHA512:
6
- metadata.gz: aaf7fcc34cb5c14705e72fea99cf013bbebcec4c06b2c5bd39d863a97ca13a14ff3c87ec70f209752f9e09c5964f49b4447bb66c5420405b9b6a61660d807f81
7
- data.tar.gz: 5626a23f9279d2989ce781141a388ac97e6f1f1cedcfe9b7b9f7b91e5455dc4c8f98c913575901ee3d94cecfce11c437abd28918cdde9544eb9564fa175fb450
6
+ metadata.gz: 5e8c6fa1bea702a974a9c0b22ec7c3f914ccceaf7c12f4bc8b5f8ce94eace7edd6dce4e47f318189e3e1b7af8c5e8ace6b00479283823274e3badfe25b6b0b07
7
+ data.tar.gz: cbb5bbfd192542785f041157232097ed01fe0d1444c20fc7c5606c1873229a7d7577183b8919f475085b5e7bf6700fae6cc987e0024fe6263cfab61f44ce898c
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- grumlin (0.20.1)
4
+ grumlin (0.20.2)
5
5
  async-pool (~> 0.3)
6
6
  async-websocket (~> 0.19)
7
7
  oj (~> 3.13)
data/lib/definitions.yml CHANGED
@@ -82,6 +82,7 @@ steps:
82
82
  configuration:
83
83
  - withSack
84
84
  - withSideEffect
85
+ - withStrategies
85
86
  expressions:
86
87
  cardinality:
87
88
  - list
@@ -56,7 +56,7 @@ module Grumlin
56
56
  with_upsert_error_handling(on_failure, params) do
57
57
  create_properties, update_properties = cleanup_properties(create_properties, update_properties)
58
58
 
59
- g.upsertV(label, id, create_properties, update_properties).next
59
+ g.upsertV(label, id, create_properties, update_properties).id.next
60
60
  end
61
61
  end
62
62
 
@@ -70,7 +70,7 @@ module Grumlin
70
70
  create_properties, update_properties = cleanup_properties(create_properties, update_properties)
71
71
 
72
72
  t.upsertV(label, id, create_properties, update_properties)
73
- end.iterate
73
+ end.id.iterate
74
74
  end
75
75
  end
76
76
  end
@@ -80,7 +80,7 @@ module Grumlin
80
80
  def upsert_edge(label, from:, to:, create_properties: {}, update_properties: {}, on_failure: :retry, **params) # rubocop:disable Metrics/ParameterLists
81
81
  with_upsert_error_handling(on_failure, params) do
82
82
  create_properties, update_properties = cleanup_properties(create_properties, update_properties, T.label)
83
- g.upsertE(label, from, to, create_properties, update_properties).next
83
+ g.upsertE(label, from, to, create_properties, update_properties).id.next
84
84
  end
85
85
  end
86
86
 
@@ -94,7 +94,7 @@ module Grumlin
94
94
  create_properties, update_properties = cleanup_properties(create_properties, update_properties, T.label)
95
95
 
96
96
  t.upsertE(label, from, to, create_properties, update_properties)
97
- end.iterate
97
+ end.id.iterate
98
98
  end
99
99
  end
100
100
  end
@@ -13,8 +13,7 @@ module Grumlin
13
13
  def initialize
14
14
  return if respond_to?(:shortcuts)
15
15
 
16
- raise RuntimerError,
17
- "steppable must not be initialized directly, use Grumlin::Shortcuts::Storage#g or #__ instead"
16
+ raise "steppable must not be initialized directly, use Grumlin::Shortcuts::Storage#g or #__ instead"
18
17
  end
19
18
 
20
19
  ALL_STEPS.each do |step|
@@ -2,6 +2,8 @@
2
2
 
3
3
  module Grumlin
4
4
  class TraversalStart < Steppable
5
+ include WithExtension
6
+
5
7
  def to_s(*)
6
8
  self.class.to_s
7
9
  end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Grumlin
4
+ module TraversalStrategies
5
+ class OptionsStrategy < TypedValue
6
+ def initialize(value)
7
+ super(type: "OptionsStrategy", value: value)
8
+ end
9
+ end
10
+ end
11
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Grumlin
4
- VERSION = "0.20.1"
4
+ VERSION = "0.20.2"
5
5
  end
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Grumlin
4
+ module WithExtension
5
+ def with(name, value)
6
+ prev = self
7
+ strategy = if is_a?(with_action_class)
8
+ prev = previous_step
9
+ TraversalStrategies::OptionsStrategy.new(args.first.value.merge(name => value))
10
+ else
11
+ TraversalStrategies::OptionsStrategy.new({ name => value })
12
+ end
13
+ with_action_class.new(:withStrategies, args: [strategy], previous_step: prev)
14
+ end
15
+
16
+ private
17
+
18
+ def with_action_class
19
+ @with_action_class ||= Class.new(shortcuts.action_class) do
20
+ include WithExtension
21
+
22
+ def with_action_class
23
+ self.class
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
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.20.1
4
+ version: 0.20.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gleb Sinyavskiy
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-07-20 00:00:00.000000000 Z
11
+ date: 2022-07-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: async-pool
@@ -154,11 +154,13 @@ files:
154
154
  - lib/grumlin/test/rspec/gremlin_context.rb
155
155
  - lib/grumlin/transport.rb
156
156
  - lib/grumlin/traversal_start.rb
157
+ - lib/grumlin/traversal_strategies/options_strategy.rb
157
158
  - lib/grumlin/traverser.rb
158
159
  - lib/grumlin/typed_value.rb
159
160
  - lib/grumlin/typing.rb
160
161
  - lib/grumlin/version.rb
161
162
  - lib/grumlin/vertex.rb
163
+ - lib/grumlin/with_extension.rb
162
164
  - lib/tasks/benchmark.rake
163
165
  homepage: https://github.com/zhulik/grumlin
164
166
  licenses: