Class: ActiveCypher::Schema::Writer::Cypher
- Inherits:
-
Object
- Object
- ActiveCypher::Schema::Writer::Cypher
- Defined in:
- lib/active_cypher/schema/writer/cypher.rb
Instance Method Summary collapse
-
#initialize(catalog, vendor) ⇒ Cypher
constructor
A new instance of Cypher.
- #to_s ⇒ Object
Constructor Details
#initialize(catalog, vendor) ⇒ Cypher
Returns a new instance of Cypher.
7 8 9 10 |
# File 'lib/active_cypher/schema/writer/cypher.rb', line 7 def initialize(catalog, vendor) @catalog = catalog @vendor = vendor end |
Instance Method Details
#to_s ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/active_cypher/schema/writer/cypher.rb', line 12 def to_s sections = [] sections << constraint_lines(@catalog.constraints) sections << index_lines(@catalog.indexes.select { |i| i.element == :node }, :node) sections << index_lines(@catalog.indexes.select { |i| i.element == :relationship }, :relationship) if @vendor == :memgraph sections << node_type_lines(@catalog.node_types) sections << edge_type_lines(@catalog.edge_types) end sections.reject(&:empty?).join("\n") end |