Class: Sequel::Postgres::PropertyGraph::Generator::Create
- Inherits:
-
Sequel::Postgres::PropertyGraph::Generator
- Object
- Sequel::Postgres::PropertyGraph::Generator
- Sequel::Postgres::PropertyGraph::Generator::Create
- Defined in:
- lib/sequel/adapters/shared/postgres.rb
Overview
Create is used to evaluate the block given to DatabaseMethods#create_property_graph, used to specify the vertices and 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
-
#edge(name, opts = OPTS, &block) ⇒ Object
Adds an edge to the property graph, with the block evaluated by Edge.
-
#initialize(&block) ⇒ Create
constructor
A new instance of Create.
-
#vertex(name, opts = OPTS, &block) ⇒ Object
Adds a vertex to the property graph, with the block evaluated by Vertex.
Methods inherited from Sequel::Postgres::PropertyGraph::Generator
Constructor Details
#initialize(&block) ⇒ Create
Returns a new instance of Create.
427 428 429 430 431 432 433 434 |
# File 'lib/sequel/adapters/shared/postgres.rb', line 427 def initialize(&block) @vertices = [] @edges = [] instance_exec(&block) @vertices.freeze @edges.freeze freeze end |
Instance Method Details
#data ⇒ Object
436 437 438 |
# File 'lib/sequel/adapters/shared/postgres.rb', line 436 def data Data.new(@vertices, @edges).freeze end |
#edge(name, opts = OPTS, &block) ⇒ Object
Adds an edge to the property graph, with the block evaluated by Edge.
446 447 448 |
# File 'lib/sequel/adapters/shared/postgres.rb', line 446 def edge(name, opts=OPTS, &block) @edges << Edge.new(name, opts, &block) end |
#vertex(name, opts = OPTS, &block) ⇒ Object
Adds a vertex to the property graph, with the block evaluated by Vertex.
441 442 443 |
# File 'lib/sequel/adapters/shared/postgres.rb', line 441 def vertex(name, opts=OPTS, &block) @vertices << Vertex.new(name, opts, &block) end |