Class: Sequel::Postgres::PropertyGraph::Generator::Edge
- Inherits:
-
Element
- Object
- Sequel::Postgres::PropertyGraph::Generator
- Element
- Sequel::Postgres::PropertyGraph::Generator::Edge
- Defined in:
- lib/sequel/adapters/shared/postgres.rb
Overview
Edge is used for block passed to Create#edge, used to configure edges in the property graph.
Defined Under Namespace
Classes: Data
Constant Summary
Constants inherited from Sequel::Postgres::PropertyGraph::Generator
Instance Method Summary collapse
- #data ⇒ Object
-
#destination(name, &block) ⇒ Object
Specify the destination for the edge, with block evaluted by Target.
-
#initialize(name, opts = OPTS, &block) ⇒ Edge
constructor
In addition to inherited behavior, raises an error if a block is not passed or source or destination is not called in the block.
-
#source(name, &block) ⇒ Object
Specify the source for the edge, with block evaluted by Target.
Methods inherited from Element
Methods inherited from Sequel::Postgres::PropertyGraph::Generator
Constructor Details
#initialize(name, opts = OPTS, &block) ⇒ Edge
In addition to inherited behavior, raises an error if a block is not passed or source or destination is not called in the block.
397 398 399 400 401 402 403 |
# File 'lib/sequel/adapters/shared/postgres.rb', line 397 def initialize(name, opts=OPTS, &block) super unless @source && @destination raise Error, "source and/or destination not defined for property graph edge" end end |
Instance Method Details
#data ⇒ Object
405 406 407 |
# File 'lib/sequel/adapters/shared/postgres.rb', line 405 def data Data.new(@name, @key, @labels, @source, @destination).freeze end |
#destination(name, &block) ⇒ Object
Specify the destination for the edge, with block evaluted by Target.
416 417 418 419 |
# File 'lib/sequel/adapters/shared/postgres.rb', line 416 def destination(name, &block) raise Error, "cannot specify multiple destinations for a property graph edge" if @destination @destination = Target.new(name, &block) end |
#source(name, &block) ⇒ Object
Specify the source for the edge, with block evaluted by Target.
410 411 412 413 |
# File 'lib/sequel/adapters/shared/postgres.rb', line 410 def source(name, &block) raise Error, "cannot specify multiple sources for a property graph edge" if @source @source = Target.new(name, &block) end |