Module: Cyrel::Pattern

Defined in:
lib/cyrel/pattern.rb,
lib/cyrel/pattern/node.rb,
lib/cyrel/pattern/path.rb,
lib/cyrel/pattern/relationship.rb

Overview

Namespace for classes representing structural components of Cypher patterns (nodes, relationships, paths).

Defined Under Namespace

Classes: Node, Path, Relationship

Class Method Summary collapse

Class Method Details

.assert_pattern!(pattern, context) ⇒ Object

Validates that the given object is a usable pattern (Path, Node, or Relationship).

Parameters:

  • pattern (Object)

    The object to validate.

  • context (String)

    Label used in the error message (e.g. “CREATE”, “MATCH”).

Raises:

  • (ArgumentError)

    When the object is not a pattern.



11
12
13
14
15
16
# File 'lib/cyrel/pattern.rb', line 11

def self.assert_pattern!(pattern, context)
  return pattern if pattern.is_a?(Path) || pattern.is_a?(Node) || pattern.is_a?(Relationship)

  raise ArgumentError,
        "#{context} pattern must be a Cyrel::Pattern::Path, Node, or Relationship, got #{pattern.class}"
end