class Aspen::Renderers::CypherBaseRenderer
Public Instance Methods
nodes(input_statements)
click to toggle source
# File lib/aspen/renderers/cypher_base_renderer.rb, line 14 def nodes(input_statements) input_statements. flat_map(&:nodes). map { |node| "MERGE #{node.to_cypher}" }. uniq. join("\n") end
relationships(input_statements)
click to toggle source
# File lib/aspen/renderers/cypher_base_renderer.rb, line 22 def relationships(input_statements) input_statements.map do |statement| if statement.type == :custom statement.to_cypher.lines.map { |line| "MERGE #{line}" }.join() elsif statement.type == :vanilla "MERGE #{statement.to_cypher}" else raise ArgumentError, "Statement is the wrong type, expected Aspen::CustomStatemen or Aspen::Statement, but got #{statement.class}" end end.join("\n") end
render()
click to toggle source
# File lib/aspen/renderers/cypher_base_renderer.rb, line 5 def render [ nodes(statements), "\n\n", relationships(statements), "\n" ].join() end